Rossler Function for beginners
2 views (last 30 days)
Show older comments
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 Comment
Star Strider
on 14 Mar 2014
Edited: Star Strider
on 15 Mar 2014
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.
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!