gtts微薄

摘要: 欧拉法% M函数euler.m function[t,y]=euler(odefun,tspan,y0,h) t=tspan(1):h:tspan(2); y(1)=y0; for i=1:length(t)-1 y(i+1)=y(i)+h*feval(odefun,t(i),y(i)); end t=t'; y=y';先保存euler.m,再在命令窗口中执行:>> odefun=inline('y-2*t/y','t','y'); >> [t,y]=euler(odefun,[0,4],1,0.01); 阅读全文
posted @ 2011-05-19 22:07 gtts 阅读(1022) 评论(0) 推荐(0) 编辑