function myfrequencyplot
% all the files are save as t and s
clc;
clear;
load f4_n1_12000_n2_9600_5.00.mat;
% 读取文件,里面保存有时间序列t和积分结果s,s有18维
disp('three frequencies');
N=1024*4;%选择点数
xtemp1=s(end-N*4:4:end,1);%转子1在x方向振幅
dt = 6/100000;%积分时,积分区间为【0,6】,点数为100000
xa=fft(xtemp1,N);%转子1在x方向位移的傅里叶变化
xa(1)=[];
f = 0.25/dt*(0:N/2)/N;
figure;
set (gcf,'Position',[400,100,400,300], 'color','w')
plot(f(1:N/2),abs(xa(1:N/2)));
h = gca;
set(h,'FontSize',14);
xlabel('Frequency( Hz)')
ylabel('Vertical Amplitude(m)') |