Thread: ode45 Matlab
View Single Post
  #5  
Old November 29th, 2008, 05:35 AM
Rapha Rapha is offline
Senior Member
 
Join Date: Nov 2008
Posts: 400
Thanks: 57
Thanked 149 Times in 142 Posts
Rapha has a spectacular aura aboutRapha has a spectacular aura about
Default

Hello CaptainBlack!

Thank you so much for your helpful comment!

Quote:
Originally Posted by CaptainBlack View Post
You will need to write a Matlab function to evaluate the derivative and pass that to ode45 (the derivative is now too complicated to be easily passed as an anonymous function).

(You cound simplify the derivative by collecting terms)
I tried it but it still doesn't work.

Code:
function dx = ivp(t, x)

dx =  \dot{x} * x;
clearly represented, I wrote \dot{x} for
\dot{\bold{x}}=\left[ \begin{array}{c}\bold{x}_3\\\bold{x}_4\\ \bold{x}_1-2\bold{x}_4-0.9(\bold{x}_1+0.1)/D_1-0.1(\bold{x}_1-0.9)/D_2 \\ \bold{x}_2-2\bold{x}_3-0.9\bold{x}_2/D_1-0.1\bold{x}_2/D_2 \end{array} \right]

then:

[t, x] = ode45(@ivp, [0, 10], [??,??,??,??] )

where t \in [0, 10] and ?? = [x_3(0); x_4(0);, ...(0); ...(0)]

this is stupid, but I don't know the initial values :-(
Reply With Quote