数学模型之微分方程及其MATLAB求解.docxVIP

  • 7
  • 0
  • 约1.09千字
  • 约 9页
  • 2020-03-26 发布于江西
  • 举报
数学模型之微分方程及其 MATLAB 求解 ---卫星轨迹等经典例题求解分析 1. 考虑初值问题画图 y ?3y ?y y = 0 y(0) = 0 y (0) =1 y (0) = ?1 2、 3、 【实验步骤与程序】 1. M -文件 建立 m 函数文件 function y=f(t,x) y=[x(2);x(3);9*x(3)^2+x(1)*x(2)]; 求解微分方程,命令如下: x0=[0;1;-1]; [t,y]=ode45(@mm,[0,2.5],x0); plot(y(:,1),y(:,2)); figure(2); plot3(y(:,1),y(:,2),y(:,3)) 2、M -文件 建立 m 函数文件 function dx=appollo(t,x) mu=1/82.45; mustar=1-mu; r1=sqrt((x(1)+mu)^2+x(3)^2); r2=sqrt((x(1)-mustar)^2+x(3)^2); dx=[x(2) 2*x(4)+x(1)-mustar*(x(1)+mu)/r1^3-mu*(x(1)-mustar)/r2^3 x(4) -2*x(2)+x(3)-mustar*x(3)/r1^3-mu*x(3)/r2^3]; 求解微分方程,命令如下: x0=[1.2;0;0;-1; options=odeset(reltol,1e-8); [t,y]=ode45(@appollo,[0,20],x0,options); plot(y(:,1),y(:,3)) title(Appollo 卫星运动轨迹) (x) (y) 3、M -文件 建立 m 函数文件 function dy=odefun(t,x) fun=@(dxy)[dxy(1)*sin(x(4))+dxy(2)^2+2*x(1)*x(3)-x(1)*dxy(1)*x(4) x(1)*dxy(1)*dxy(2)+cos(dxy(2))-3*x(3)*x(2)]; options=optimset(display,off); y=fsolve(fun,x([1,3]),options);%使用 fsolve 求解出 x和 y dy=[x(2);y(1);x(4);y(2)];%状态变量一阶微分值 求解微分方程,命令如下: [t,y]=ode45(@odefun,[0 3],[1 0 0 1]); plot(t,y) legend(x,x,y,y)

文档评论(0)

1亿VIP精品文档

相关文档