Why is the result of system simulation and the convolution with its impulse response differs?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hallo, I have been working on this for 2 days. the result of convolution with impulse response and the result of automatic simulation of the system on the signal x differ from each other, where that should'nt happen according to the theorie. please help me with this problem.
clear all
Fs =2^11;
Ts = 1/Fs;
sys = tf([5 0],[1 1]);
f = Fs/2 *linspace(0,1,2^12);
ind = 2500;
amp_x = 1;
% amplitude for sinusodial 2
amp_y = 1;
freq1 = f(ind)/(2*pi);
t = 0:1/Fs:2 - 1/Fs;
x = amp_x * sin(2*pi*freq1*t);
[data,t_imp] = impulse(sys);
xi = 0:Ts:t_imp(length(t_imp));
data1 = interp1(t_imp,data,xi,'spline');
xa = conv(x,data1,'full');
figure;
subplot(2,2,[1 2]);
plot(t,xa(1:length(t)))
title(['freq = ' num2str(f(ind)) 'rad/s , ' num2str(f(ind)/(2*pi)) ' Herz' ]);
hold on
[ya,tsys] = lsim(sys,x,t);
% subplot(2,2,2)
plot(t,ya,'r--')%(1:length(ya)/2));
legend('conv','sim');
[m,p] = bode(sys,f);
plot(t,ones(1,length(t))*m(ind),'c--'); %find(abs(f-freq)<1e-3)
subplot(2,2,[3 4]);
bode(sys)
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Digital Filter Analysis finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!