Torsten
Posts:
1,182
Registered:
11/8/10
|
|
Re: Driven van der Pol oscillator (n = 2)
Posted:
Feb 22, 2013 2:42 AM
|
|
"Sam Clark" <destroythemap666@hotmail.co.uk> wrote in message <kg5elm$1lv$1@newscl01ah.mathworks.com>...
> > > > "Steven_Lord" <slord@mathworks.com> wrote in message <kg5bve$m1k$1@newscl01ah.mathworks.com>... > > > > > > "Sam Clark" <destroythemap666@hotmail.co.uk> wrote in message > > news:kg58ob$boj$1@newscl01ah.mathworks.com... > > > Hi Steve- thanks for the response. > > > I'm sorry i don't understand what you mean in your second paragraph. Could > > > you if possible attach a sample code or link me to a similar task? > > > > > > > > > ttt=[1:1:100] > > > Mu= 1000; > > > > > > for ttt(1):ttt(100) > > > > for eachElementOfTTT = ttt > > % eachElementOfTTT will take on each element from ttt in turn > > > > > rehash > > > ode= @(t,y) vdp(t,y,Mu,ttt); > > > > ode = @(t, y) vdp(t, y, Mu, eachElementOfTTT); > > % Use this iteration's specific element from ttt, not ALL the elements from > > ttt at once. > > > > > [t,y]=ode15s(ode,[0, 3000],[2;0]); > > > > > > Is this what you mean? I get error when i try this. > > > One final question: i am using "rehash" to hopefully update the value of > > > "ttt" in the "vdp" function... is this what is actually happening? > > > > Nope. That's not what REHASH is for. REHASH is for when you're modifying > > files on your path and want to be sure that MATLAB recognizes that those > > files have changed. > > > > -- > > Steve Lord > > slord@mathworks.com > > To contact Technical Support use the Contact Us link on > > http://www.mathworks.com
> Again thanks for the swift response. > > My code now is as follows: > > ttt=[1:1:100]; > Mu= 1000; > > for eachElementofTTT = ttt > ode= @(t,y) vdp(t,y,Mu,eachElementofTTT); > [t,y]=ode15s(ode,[0, 3000],[2; 0]); > end > > I'm still not getting required results (i'll explain). My workspace says "eachElementofTTT" = 100, not an array of elements. > > My program is to put impulse sinusoids into function and monitor outputs. I'm trying to illustrate phase locking so i need to see frequency domain graph. To do this i use : > > figure > plot(t, fft(y(:,1))) > linkdata on > > But i don't see desired output (i should hopefully see just two frequencies displayed but instead get some sort of broken graph.) I also get error "Warning: Imaginary parts of complex X and/or Y arguments ignored" and this points to the "plot(t, fft(y(:,1)))" line code. I'm starting to now wonder wether the program works correctly but the FFT graph display is wrong.... to be honest i'm getting a little confused now. > > Really sorry about all this, i'm new to this program. Again thanks alot for all the help.
Start simple. Solve your system of ODEs for one value of ttt and look at the result. I think you'll have to use a very small initial step size to resolve the high-frequency terms sin(900*t) etc., and the integration up to t=3000 will take quite a long time. You may want to replace the 900 by a smaller coefficient at first.
Best wishes Torsten.
|
|