solve a system of ODE
Show older comments
Hi, this is explicit Euler method to solve a ODE
function [x,t]=euleroesplicito(fcn,t0,x0,h,tend) n = fix((tend-t0)/h)+1; t = linspace(t0,t0+(n-1)*h,n); x = zeros(n,1); x(1) = x0; for i = 2:n x(i) = x(i-1) + h*feval(fcn,t(i-1),x(i-1)); end plot(t,x);
How can I extend this method to solve a system of two or more equations? Thank you.
Accepted Answer
More Answers (0)
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!