Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Torsten
Posts:
1,627
Registered:
11/8/10


Re: help with ode45 function
Posted:
Feb 12, 2013 11:07 AM


"Lee" wrote in message <kf72pc$b4i$1@newscl01ah.mathworks.com>... > Hello, > I'm trying to solve a firstorder differential equation using 'ode45', and it is taking way too long. I'm wondering if I am doing something wrong. > > Basically, the ODE I'm trying to solve is V' = constant*f(V) > > So, I have a fun1.m file: > > function f = fun1(t,Vm) > > gk = 0.415; > gcl = 0.582; > gna = 0.01; > Ek = 74.7*10^3; > Ena = 54.2*10^3; > Ecl = 65.8*10^3; > Cm = 1e6; > > f = (1/Cm)*(gk*(VmEk)+gna*(VmEna)+gcl*(VmEcl)); > > Then, I am doing: > > clear all > Vm_initial = 60*10^3; > [t1 f1] = ode23('fun1',[0 10],Vm_initial); > plot(t1,f1);
Your differential equation has the form dy/dt = a*y + b, y(t0)=y0 (a = 1/Cm*(gk+gna+gcl) and b=1/Cm*(gk*Ek+gna*Ena+gcl*Ecl)) with analytical solution y(t)=((a*y0+b)*exp(a*(tt0))b)/a No need to use a numerical integrator for your case.
Best wishes Torsten.



