1.问题


2.运动方程
Step1: 将微分方程最高阶变量移到等式左边

Step2: 为每一阶微分式选择状态变量,最高阶除外
2.1
'
''
...

2.2: 同时求导
2.3:整理为形式,各阶微分式替换为状态变量
3.1 Matlab 求解代码与结果
clear;clc;
tic
options = odeset('reltol',1e-13);
tspan = [0,80];
[tspan,x]=ode45(@vibration,tspan,[1 1],options);
toc
figure
plot(tspan,x(:,1),tspan,x(:,2));
legend('Position','Acceleration')
%Time Domain
fig = figure('Name','Position');
plot(x(:,1))
%Purpose Function
function dxdt = vibration(~ ,x)
%for t= 0:0.01:40
%f = cos(10*t);
f=0;
c = 0.3;
k = 5;
m = 1;
dxdt = [0;0];
dxdt(1) = x(2);
dxdt(2) =(1/m)*( f - c*x(2) - k*x(1));
end

3.2 Simulink程序图与结果

Scope显示为:

网友评论