📄 odeeuler.mht
字号:
From: <Saved by Windows Internet Explorer 7>
Subject:
Date: Tue, 12 May 2009 09:53:05 -0700
MIME-Version: 1.0
Content-Type: text/html;
charset="Windows-1252"
Content-Transfer-Encoding: 7bit
Content-Location: http://www.mece.ualberta.ca/Courses/mec390/390code/odeeuler.m
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 6.00.6000.16825" name=GENERATOR></HEAD>
<BODY><PRE>function [t,y] = odeeuler(func,a,b,y0,h);
% solution routine for Euler's method for solving
%
% dy/dt = func(t,y)
%
% USAGE: [t,y] = odeeuler(func,a,b,y0,h)
%
% input func = name of external function to evaluate the RHS
% of the ODE
% a, b = limits of integration
% y0 = initial condition
% h = stepsize
%
% output [t, y] = solution vectors
t = [a];
y = [y0];
i = 1;
while t(i) < b
i = i+1;
t(i) = a + (i-1)*h;
y(i) = y(i-1) + h*feval(func,t(i-1),y(i-1));
end
</PRE></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -