MATLAB如何解非线性微分方程组dx/dt=450/sqrt(1+((120-y)/(90*t-x))^2)dy/dt=450/sqrt(1+((90*t-x)/(120-y))^2)x(0)=0,y(0)=0运行出来的结果是什么?

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/01 00:31:18
MATLAB如何解非线性微分方程组dx/dt=450/sqrt(1+((120-y)/(90*t-x))^2)dy/dt=450/sqrt(1+((90*t-x)/(120-y))^2)x(0)=0,y(0)=0运行出来的结果是什么?

MATLAB如何解非线性微分方程组dx/dt=450/sqrt(1+((120-y)/(90*t-x))^2)dy/dt=450/sqrt(1+((90*t-x)/(120-y))^2)x(0)=0,y(0)=0运行出来的结果是什么?
MATLAB如何解非线性微分方程组
dx/dt=450/sqrt(1+((120-y)/(90*t-x))^2)
dy/dt=450/sqrt(1+((90*t-x)/(120-y))^2)
x(0)=0,y(0)=0
运行出来的结果是什么?

MATLAB如何解非线性微分方程组dx/dt=450/sqrt(1+((120-y)/(90*t-x))^2)dy/dt=450/sqrt(1+((90*t-x)/(120-y))^2)x(0)=0,y(0)=0运行出来的结果是什么?
function [t,x]=solv(tspan)
% argument
% tspan stands for time span
x0   =[0,0];
[t,x]=ode45(@odefun,tspan,x0);
subplot(2,1,1),plot(t,x(:,1),'-'),title('P');
subplot(2,1,2),plot(t,x(:,2),'-'),title('y');
end
function dx=odefun(t,x)
dx=zeros(2,1);
if abs(90*t-x(1))<eps
 dx(1)=0;
else
 dx(1)=450/sqrt(1+((120-x(2))/(90*t-x(1)))^2);
end
if abs(120-x(2))<eps
 dx(2)=0;
else
 dx(2)=450/sqrt(1+((90*t-x(1))/(120-x(2)))^2);
end
end 
matlab只能给出数值解,所谓数值解也就是指定有限点上的函数取值,一般没法用显式的函数表达式来描述.
将上述代码保存为solv.m,运行[t,x]=solv([0:0.01:1])便能得到[0:1]区间上函数取值.