Calculating Response of a system with lsim versus convolution
1 view (last 30 days)
Show older comments
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')
0 Comments
Answers (0)
See Also
Categories
Find more on Digital Filter Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!