用ODE函数解微分方程和用dsolve有什么区别?微分方程为:y''+4*y'+29y=0,y(0)=0,y'(0)=15这是用dsolvey = dsolve('D2y+4*Dy+29*y=0','y(0)=0,Dy(0)=15','x');x = linspace(-3,3,100);yd = eval(y);plot(x,yd)这是用ODE函数:function dy=v
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/29 18:35:58
用ODE函数解微分方程和用dsolve有什么区别?微分方程为:y''+4*y'+29y=0,y(0)=0,y'(0)=15这是用dsolvey = dsolve('D2y+4*Dy+29*y=0','y(0)=0,Dy(0)=15','x');x = linspace(-3,3,100);yd = eval(y);plot(x,yd)这是用ODE函数:function dy=v
用ODE函数解微分方程和用dsolve有什么区别?
微分方程为:y''+4*y'+29y=0,y(0)=0,y'(0)=15这是用dsolvey = dsolve('D2y+4*Dy+29*y=0','y(0)=0,Dy(0)=15','x');x = linspace(-3,3,100);yd = eval(y);plot(x,yd)这是用ODE函数:function dy=vdp1000(t,y)dy=zeros(2,1);dy(1)=y(2);dy(2)=-4*y(2)-29*y(1);[T,Y]=ode15s('vdp1000',[-3,3],[0,15]);plot(T,Y(:,1),'-')他们的结果差距很大啊!
用ODE函数解微分方程和用dsolve有什么区别?微分方程为:y''+4*y'+29y=0,y(0)=0,y'(0)=15这是用dsolvey = dsolve('D2y+4*Dy+29*y=0','y(0)=0,Dy(0)=15','x');x = linspace(-3,3,100);yd = eval(y);plot(x,yd)这是用ODE函数:function dy=v
数值解(ode系列)和解析解(即公式解,dsolve)的区别.查看原帖>>
回复xiaochao84 的帖子第二种方法求解(数值解)的时候把初值对错了,这样就可以了:y = dsolve('D2y+4*Dy+29*y=0','y(0)=0,Dy(0)=15','x');x = linspace(0,3,100);yd = eval(y);plot(x,yd)hold onfun = @(t,y)[y(2);-4*y(2)-29*y(1)];[T,Y] = ode15s(f...
全部展开
回复xiaochao84 的帖子第二种方法求解(数值解)的时候把初值对错了,这样就可以了:y = dsolve('D2y+4*Dy+29*y=0','y(0)=0,Dy(0)=15','x');x = linspace(0,3,100);yd = eval(y);plot(x,yd)hold onfun = @(t,y)[y(2);-4*y(2)-29*y(1)];[T,Y] = ode15s(fun,linspace(0,3,100),[0,15]);plot(T,Y(:,1),'r-') 查看原帖>>
收起
变量代换把高阶微分方程化为一阶微分方程组,编写目标函数时顺序其实无所谓。 查看原帖>>