⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 feuler.m

📁 sareli<matlab科学计算>配套程序
💻 M
字号:
function [t,y]=feuler(odefun,tspan,y,Nh,varargin)%FEULER  Solve non-stiff differential equations, one order method.%   [T,Y] = FEULER(ODEFUN,TSPAN,Y0,NH) with TSPAN = [T0 TFINAL] integrates the%   system of differential equations y' = f(t,y) from time T0 to TFINAL with%   initial conditions Y0 using the forward Euler method on an equispaced%   grid of NH intervals. Function ODEFUN(T,Y) must return a column vector%   corresponding to f(t,y). Each row in the solution array Y corresponds to%   a time returned in the column vector T. %   [T,Y] = FEULER(ODEFUN,TSPAN,Y0,NH,P1,P2,...) passes the additional%   parameters P1,P2,... to the function ODEFUN as ODEFUN(T,Y,P1,P2...).    h=(tspan(2)-tspan(1))/Nh;tt=linspace(tspan(1),tspan(2),Nh+1);for t = tt(1:end-1)    size(y),     size(feval(odefun,t,y(end,:),varargin{:}))   y = [y; y(:,end) + h*feval(odefun,t,y(:,end),varargin{:})]; end t=tt;return

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -