clc;
source=simout1;
filter=simout2;
%% 原始数据
subplot(3,1,1);
plot(source.Time,source.Data,'b',filter.Time,filter.Data,'r');
title('数据');
legend('原始数据','滤波之后数据');
grid on;
%% fft
Ts=1000;
x=source.Data;
N=source.Length;
n=1:N;
n_2=1:N/2;
f=n*Ts/N;
y=fft(x,N);
mag=abs(y);
subplot(3,1,2);
plot(f(n_2), mag(n_2));
title('原始数据fft');
axis([0 Ts/2 0 3*1e6]);
grid on;
%% fft
Ts=1000;
x=filter.Data;
N=filter.Length;
n=1:N;
n_2=1:N/2;
f=n*Ts/N;
y=fft(x,N);
mag=abs(y);
subplot(3,1,3);
plot(f(n_2), mag(n_2));
title('滤波之后数据fft');
axis([0 Ts/2 0 3*1e6]);
grid on;