美文网首页程序园程序员
单自由度振动方程与Matlab/Simulink求解

单自由度振动方程与Matlab/Simulink求解

作者: Disth | 来源:发表于2019-02-19 22:29 被阅读113次

1.问题

引用1:质量-弹簧-阻尼系统 引用2:模型推导

2.运动方程

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

式1

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

2.1

x_{1}  = x

x_{2}  = x'

x_{3}  = x''

...

式2: 通项

2.2: 同时求导

\dot{x_{1} } =\dot{x}

\dot{x_{2} } =\ddot{x}

2.3:整理为\frac{dy}{dt} 形式,各阶微分式替换为状态变量

\frac{dx(1)}{dt} = \dot{x}  =x_{2} 

\frac{dx(2)}{dt} = \ddot{x} =\frac{1}{m} * (\mu -c*x(2)-k*x(1))

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

图1: 加速度与位移

3.2 Simulink程序图与结果

图2:初值x(0) = 0, x(1) = 1, m = 1, k = 4, c = 0.1

Scope显示为:

                                       

相关文章

网友评论

    本文标题:单自由度振动方程与Matlab/Simulink求解

    本文链接:https://www.haomeiwen.com/subject/jkhqyqtx.html