Rossler Function for beginners

조회 수: 4 (최근 30일)
rahma
rahma 2014년 3월 14일
편집: Star Strider 2014년 3월 15일
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
Star Strider
Star Strider 2014년 3월 14일
편집: Star Strider 2014년 3월 15일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by