Rossler Function for beginners

4 vues (au cours des 30 derniers jours)
rahma
rahma le 14 Mar 2014
Modifié(e) : Star Strider le 15 Mar 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 commentaire
Star Strider
Star Strider le 14 Mar 2014
Modifié(e) : Star Strider le 15 Mar 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.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by