matlab - Error in Ordinary Differential Equation representation -


update trying find lyapunov exponents given in link le. trying figure out , understand taking following eqs case. these set of ordinary differential equations (these testing how work cos , sin 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 , f3 in case -10sinx. however,when expressing x=x(1);y=x(2);i unsure how express cos.this trial example doing know how work equations have cos,sin etc terms function of variable.

when using ode45 solve these eqs

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

it throws following error

??? attempted access (2); index must positive integer or logical.

error in ==> eq @ 19 x=x(1); y=x(2); cos(x)=x(3);  
  1. is representation x=x(1); y=x(2); cos(y)=x(3); alright?
  2. how resolve error? thank you

no representation wrong. can't possibly set values in way! start, trying assign value x(3) function.

first not sure understand difference between

x=4 

and

4=x 

which different meanings. if understand this, you'll see can't possibly assign using cos(x)=x(3).

second: function sol() calling? have defined it?

third, solve or evaluate odes should using deval or solve functions in matlab. files should give examples.


Comments

Popular posts from this blog

All overlapping substrings matching a java regex -

c++ - Using OpenSSL in a multi-threaded application -

php - Deleting/Renaming a locked file -