- #1

- 16

- 0

I'm trying to use MATLAB to obtain simulations for some equations that describe a model. I'm new to MATLAB (though I've taken a course in C++ and another in Java), so I read a bit on the mathworks website on solving ODEs, and settled on ode45

The equations I'm trying to model are the following (see link):

http://i.imgur.com/vWATx.jpg

As can be seen, the first equation is a straightforward (I guess?) ODE, where the L function is defined, for some x, as L(x)=coth(x)-(1/x). I was not sure how to write that (d ln L/dE)^(-1), so I just had WolframAlpha evaluate it and I typed it in.

Mentioned earlier, I believe that I got the code down for the first ODE:

PHP:

```
%this is the M-file firstode
%tau_B = 0.0016
function Eprime = firstode(t,E);
Eprime=(((0.0016).^(-1))*((coth(E)-(1./E))/((E).^(-2)-(csch(E)).^(2)))*(((10)/E)*cos(625*t)-1));
%this is the main file, firstodesolver.m
tspan=[0,0.2];
E0=10;
[t,E]=ode45(@firstode,tspan,E0);
plot(t,E, 'b-')
```

sol = ode45(@firstode,tspan,E0)

would do it...but that doesn't seem to work. Can y'all provide any suggestions?

*NOTE: The code written does not include anything re. the second equation as I've yet to solve the dilemma I'm facing.*

Sorry for the long post. Thanks all!

MATLAB's a bit strange -- this would be nicer on C++ :(

Sincerely,

RedAnsar