www.gusucode.com > 转子轴承系统模型,求转子系统的轨迹波形图及振动的频率图的主程序 > 转子轴承系统模型,求转子系统的轨迹波形图及振动的频率图的主程序/mainfun.m

    clc;clear;

T=(0:0.00001:0.5)';% 时间轴
C=150; % 阻尼
rpm=8500; %转子转速
Ini=zeros(4,1); % x1x2x3x4的初始值,均为零。
options = odeset('abstol',1e-10,'reltol',1e-10);
[t,X]=ode15s(@(t,X) myfun(t,X,C,rpm),T,Ini,options); %利用微分方程求解器ODE15求解
% [t,X]=ode45(@myfun,T,Ini,options,C,rpm);
figure,
subplot(211);plot(t(10000:end),X(10000:end,1));
subplot(212);plot(t(10000:end),X(10000:end,3));
figure,plot(X(10000:end,1),X(10000:end,3)) %轴心轨迹图
x=X(1:end,1);
y=X(1:end,3);
e=sqrt(x.^2+y.^2);
fs=1/0.00001;
ee=fft(x);
freq=(1:fix(length(e)/2))*fs/length(e);
eee=abs(ee(1:length(freq)));
figure,plot(freq,eee) % 位移频谱图
xlim([100 5000])