Error in Ordinary Differential Equation representation

Posted by Priya M on Stack Overflow See other posts from Stack Overflow or by Priya M
Published on 2012-06-29T00:39:08Z Indexed on 2012/06/30 21:16 UTC
Read the original article Hit count: 242

UPDATE I am trying to find the Lyapunov Exponents given in link LE. I am trying to figure it out and understand it by taking the following eqs for my case. These are a set of ordinary differential equations (these are just for testing how to work with cos and sin as ODE)

f(1)=ALPHA*(y-x);
f(2)=x*(R-z)-y;
f(3) = 10*cos(x);

and x=X(1); y=X(2); cos(y)=X(3);

f1 means dx/dt;f2 dy/dt and f3 in this case would be -10sinx. However,when expressing as x=X(1);y=X(2);i am unsure how to express for cos.This is just a trial example i was doing so as to know how to work with equations where we have a cos,sin etc terms as a function of another variable.

When using ode45 to solve these Eqs

[T,Res]=sol(3,@test_eq,@ode45,0,0.01,20,[7 2 100 ],10);

it throws the following error

??? Attempted to access (2); index must be a positive integer or logical.

Error in ==> Eq at 19
x=X(1); y=X(2); cos(x)=X(3); 
  1. Is my representation x=X(1); y=X(2); cos(y)=X(3); alright?
  2. How to resolve the error? Thank you

© Stack Overflow or respective owner

Related posts about matlab

Related posts about ode