MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [求助]共有3个题目要做报告,貌似有点错误谁帮我稍微修改下。。。 (https://www.labfans.com/bbs/showthread.php?t=5777)

幻紫风 2008-12-11 21:14

[求助]共有3个题目要做报告,貌似有点错误谁帮我稍微修改下。。。
 
对初值问题

y'=1/(1+x*x)-2*y*y,0<x<1;
y(0)=0;
试用Euler法取步长h=0.1和h=0.2计算其近似解,用Matlab实现求解。
源代码:
function[x,y]=Euler1(dyfun,xspan,y0,h)
x=xspan(1):h:xspan(2);
y(1)=y0;
for n=1:length(x)-1
y(n+1)=y(n)+h*feval(dyfun,x(n),y(n));
end
x=x';y=y';


所有时间均为北京时间。现在的时间是 12:26

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.