Calculating Response of a system with lsim versus convolution

5 vues (au cours des 30 derniers jours)
S H
S H le 23 Fév 2019
A square wave is applied to two high-pass and low-pass filters in the following codes. Could you explain why lsim shows different response than convolution for the high-pass and almost the same response for the low-pass filter? What are missing in these codes to calculate the response correctly?
syms s
tfunc1=(5e-25*s^2+1e-08*s)/(1e-24*s^2+1e-08*s+1); %high-pass filter
tfunc2=(5e-17*s+1)/(5e-25*s^2+1e-08*s+1); %low-pass filter
tfunc=tfunc2; %choose tfunc1 for high-pass filter and tfunc2 for low-pass filter
[symNum,symDen]=numden(tfunc);
TFnum=sym2poly(symNum);
TFden=sym2poly(symDen);
sys=tf(TFnum,TFden);
[yy,tt]=impulse(sys);
[xt,time]=gensig('square',tt(end),4*tt(end),tt(2)-tt(1));
out=(tt(2)-tt(1))*conv(yy,xt,'full');
lsimplot(sys,xt,time)
hold on
plot(time,out(1:length(time)),'r')

Réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by