我的(简化的)问题:假设我有一个信号,通过系统/过滤器, 给出输出信号. 然后我有一个定理说:
如果一个信号, 傅里叶变换应用于系统,然后是输出的傅里叶变换是(谁)给的:
我尝试在 MATLAB 中验证这一点,但出现了问题。
执行:
使用 很容易获得
fft(u)
。为了我使用
freqresp
(系统,) (并构建 以这样的方式,它与 fft 结果的格式相同:[dc positive-freqsnegative-freqs])。我通过将结果与波特图进行比较来验证这一点(请参阅脚本中的注释行)
为了验证我执行傅里叶逆变换y = ifft(Y)
并比较获得的到 lsim 结果,这是通过= lsim(G,u)
。不幸的是,这些不匹配。我错过了什么?
clear
close all
G = tf([4700 4393 3.245e08],[1 7.574 1.202e5 0 0]);
f_sh = 1000; %sampling frequency
Gd = c2d(G,1/f_sh); %plant discretization
t_end = 10; %[s] simulation time end
t = linspace(0,t_end,t_end*f_sh+1); %time vector
f_ref = 0.5; %reference freq
u = sin(2*pi*f_ref*t); %reference signal
L = length(u);
dF = f_sh/L; %frequency bin step
w = dF:dF:f_sh/2; %one-sided frequency vector in Hz
w_eval = 2*pi*[0 w -fliplr(w)]; %frequency vector for freqresp, formatted to match fft results
H = freqresp(Gd,w_eval); %frequency response of system wrt freq vec
H = transpose(squeeze(H)); %remove singelton dimensions
% bode(Gd) %should be equal to the semilog plot
% figure
% semilogx(w,20*log10(abs(H(2:(L+1)/2)))) %plot in Hz
U = fft(u);
Y = H.*U;
y = ifft(Y); %frequency domain response
yprime = lsim(Gd,u); %simulation/time domain resonse
figure
plot(t,yprime,t,y) %y should equal yprime
legend('lsim response','fft(sys)*fft(ref) response')
lsim 结果似乎在其中有一些积分器效应???