关于fft变换时域信号频域不对应的问题。

在对动力学方程求解得到时域响应时,利用傅立叶(fft)变换得到频域响应,但是结果显示两者的频率无法对应起来,求大神解释啊!下面是代码
clc
clear all
tspan=[0,100]
y0=[0 0 0 0 0 0 0 0 0 0 0 0]
[T,Y]=ode15s(@fun2,tspan,y0)
plot(T,Y(:,1))
xlabel('Time');ylabel('Amplitude');
figure
plot(T,Y(:,2))
xlabel('Time');ylabel('Amplitude');
figure
plot(T,Y(:,3))
xlabel('Time');ylabel('Amplitude');
figure
plot(T,Y(:,4))
xlabel('Time');ylabel('Amplitude');
figure
plot(T,Y(:,5))
xlabel('Time');ylabel('Amplitude');
figure
plot(T,Y(:,6))
xlabel('Time');ylabel('Amplitude');
figure
plot(T,Y(:,7))
xlabel('Time');ylabel('Amplitude');
figure
plot(T,Y(:,8))
xlabel('Time');ylabel('Amplitude');
figure
plot(T,Y(:,9))
xlabel('Time');ylabel('Amplitude');
figure
plot(T,Y(:,10))
xlabel('Time');ylabel('Amplitude');
figure
plot(T,Y(:,11))
xlabel('Time');ylabel('Amplitude');
figure
plot(T,Y(:,12))
xlabel('Time');ylabel('Amplitude');
%%求加速度
z1=gradient(Y(:,4),T);
figure%13
plot(T,z1)
%%傅立叶变换
fss=200
t1=0:1/fss:100
z=interp1(T,z1,t1)
figure%14
plot(t1,z)
xlabel('Time');ylabel('Amplitude');
N = 1024
n1 = 0:N-1;
fs1=200
f1=n1*fs1/N;
y1=fft(z,N);
mag1=abs(y1)*2/N;
figure%15
plot(f1(1:N/2),mag1(1:N/2),'r')
xlabel('Frequency');ylabel('Amplitude');

回答(0 个)

类别

帮助中心File Exchange 中查找有关 MATLAB 的更多信息

标签

提问:

N/A
2022-11-21

Community Treasure Hunt

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

Start Hunting!