File 'ode1' not found.
4 次查看(过去 30 天)
显示 更早的评论
Hi guys, if I type this (type ode1) I'm going to make these mistakes! Error using type File 'ode1' not found. why? Thanks
0 个评论
回答(2 个)
Alvin
2023-10-8
You can create one yourself, then you can type it.
function [yout] = ode1(F, t0, h, tfinal, y0)
% ODE1 is a simple ODE solver.
% dy/dt = F(t, y) with y(t0) = y0
y = y0;
yout = zeros((tfinal-t0)/h+1, 1); yout(1) = y0;
for t = t0+h : h : tfinal
s = F(t, y); % Slope
y = y + h * s; % from y(t) to y(t+h)
yout(round((t-t0)/h+1)) = y; % list of y's are recorded
end
end
1 个评论
Walter Roberson
2023-10-8
You can, but in my answer I linked to some pre-written fixed-step ODE solvers supplied by Mathworks
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!