Solving nonlinear scalar ode's
Afficher commentaires plus anciens
I have to solve an ivp of the form: du/dt = f(t,u), u(t0) = u0, for a function u = u(t)?R for t=>t0, using Adams Bashforth 2nd order linear multistep method.
I have to write a function file with input t0 = initial time, tf = final time, u01=[u0; u1], n = number of time steps.
And output: t - is vector of length n+1 containing the times t0,t1,...,tn , and u - is a vector of length n+1 with the first element of u being u0 and with the (i+1) the element of u being the approximation ui for i=1,...,n.
So far i have: funtion [t,u]=ivpab2(t0,tf,u01,n) and i know that h=(tf-t0)/n and t(i)=t0+i*h The testing is to be done for the function u'=f(t,u)=-2*u+3*exp(-2*t)cos(3*t) which also needs to be implemented into this function file.
I would be extremely thankful for any help to how to even start with this.
Thank you.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!