The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: help with ode45 function
Replies: 2   Last Post: Feb 12, 2013 11:07 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Jan Simon

Posts: 2,927
Registered: 10/6/08
Re: help with ode45 function
Posted: Feb 11, 2013 10:50 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Dear Lee,

Please explain in "way too long" means milliseconds or hours.
You can improve the code a little bit: The power operation is very expensive, but not needed here:

function f = fun1(t,Vm)

gk = 0.415;
gcl = 0.582;
gna = 0.01;
Ek = -74.7e-3;
Ena = 54.2e-3;
Ecl = -65.8e-3;
Cm = 1e-6;

f = (gk*(Ek-Vm)+gna*(Ena-Vm)+gcl*(Ecl-Vm)) / Cm;

This is *not* a call to ODE45, but to ODE23:
> [t1 f1] = ode23('fun1',[0 10],Vm_initial);

Did you try it with ODE45 also?

Kind regards, Jan

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.