Rossler Function for beginners

4 Ansichten (letzte 30 Tage)
rahma
rahma am 14 Mär. 2014
Bearbeitet: Star Strider am 15 Mär. 2014
I'm a beginner and I have some trouble with a Rossler function I have to create. the professor asked to write this: function ydot = rossler(a,y) b=0.6; c=6; ydot(1) = -y(2) - y(3); %(1a) ydot(2) = y(1)+ a * y(2); ydot(3) = b + y(3) * (y(1) - c);
Now I don't understand what y means as an argument of rossler . Is it y1 ? Is it y2 ? is it y3 ? Is it all ? and for what t ? I asked the professor and he said that y is a vector( which didn't help me that much. )
Then, I am asked to solve for y1 , y2 y3 (using Euler's method) So I used this code: h = 0.01; t = [0:h:100]; %Set the time discretisation y(1) = 0; y(2) = 0; y(3)=0; %Initial conditions y(101,2) = 1; for n=1:100 % Perform Euler step y(n+1,:) = y(n,:) + h*rossler(a,y(n,:)); end I added y(101,2) = 1; because Matlab tells me that y appear to be changing size on every loop, but it didn't change anything , I still get the same error message. I also have one more question if I may : When does t come into play ? how can I write y1(t)= blablabla ?
Thank you very much, I really appreciate it!
  1 Kommentar
Star Strider
Star Strider am 14 Mär. 2014
Bearbeitet: Star Strider am 15 Mär. 2014
I hope your professor also mentioned ode45 and the other differential equation solvers.
As for the ‘changing size in every loop’ message, it just suggests that preallocating with a vector of zeros for y will speed up your code.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by