ode - Matlab ode45 vs. ode23, different solutions -


i used ode45 , ode23 set of non-stiff differential equations. however, both methods converge different solution. how can find out 1 correct? see attached plot blue ode45, red ode23. dashed lines final values each solver. also, ode15s bit different (less 1 m)...

enter image description here

matlab's ode solvers adaptive 1 specifies tolerances rather step size (see this answer). given code in pdf linked in comments, if specify smaller value relative tolerance, solutions ode45 , ode23 converge after same amount of time. can use odeset set 'reltol':

... opts = odeset('reltol', 1e-12); [t, oput] = ode23(@(t,y)secondode(t,y,c,g), tspan, ic, opts); ... 

note got rid of global variables used in linked code (they're bad , inefficient). need change function definition secondode to:

function z = secondode(t, indata, c, g) ... 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -