[轉貼] 非線性微分方程的求解

[轉貼] 非線性微分方程的求解


下面是單自由度的非線性微分方程的求解程序(分段函數)。多自由度的正在努力中,希望能和大家多多交流!
非線性微分方程表達式的函數:
function vprime= aadlx(t,x)


% x(1)為位移 x(2)為速度 分段函數
if x(1)>1
vprime=[x(2);1.1+0.1*cos(0.5*t)+0.075*sin(0.5*t)-0.02*x(2)-(1+0.1*cos(0.5*t))*x(1)];
elseif -1<=x(1)<=1
vprime=[x(2);0.1+0.075*sin(0.5*t)-0.02*x(2)];
else
vprime=[x(2);-0.9-0.1*cos(0.5*t)+0.075*sin(0.5*t)-0.02*x(2)-(1+0.1*cos(0.5*t))*x(1)];
end
運行以下內容即可得到結果:
options=odeset('RelTol',1e-4,'AbsTol',[1e-6]);


tspan=[0,900];
[t,x]=ode45('aadlx',tspan,[0;0],options);
u1=x(:,1);
u2=x(:,2);



figure('unit','normalized','color',[1,1,1]);
h=get(gcf);
set(gcf,'Name','1','numbertitle','off');
plot(t,u1)
title('圖1')
xlabel('時間t');ylabel('位移x');
grid on

figure('unit','normalized','color',[1,1,1]);
h=get(gcf);
set(gcf,'Name','2','numbertitle','off');
plot(u1,u2)
title('圖2')
xlabel('位移x');ylabel('速度dx');
grid on


摘自 振動論壇 歡迎大家訪問振動論壇 http://vib.hit.edu.cn/forum/index.php?fromuid=32262

登錄后免費查看全文
立即登錄
App下載
技術鄰APP
工程師必備
  • 項目客服
  • 培訓客服
  • 平臺客服

TOP

1