Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: trying to plot difference between input frequency and estimated frequency ?
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
aniket

Posts: 23
Registered: 1/15/13
trying to plot difference between input frequency and estimated frequency ?
Posted: Feb 6, 2013 6:00 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

hello ,

I want to plot a graph of difference between input signal frequency and adapted frequency . how should i do it ?

here is my code

in this,

fin is input signal frequency

y(3) mention in function is oscillator initial frequency

dz(3) mention in function is learning rule for oscillator frequency, because of this oscillator adapts input signal frequency.

i want to plot difference of fin and dz(3)

for example
D = fin - dz(3)

**********************

function dz = myeqd(t,y,ti,fi)

dz = zeros(3,1);

mu=0.7;

r= sqrt(y(1)^2 + y(2)^2);

K=2;

F=interp1(ti,fi,t);

dz(1)= (mu - r^2)*y(1) - y(3)*y(2) +K*F;

dz(2) = (mu - r^2)*y(2) + y(3)*y(1);

dz(3) = (-K*F) * (y(2)/sqrt(y(1)^2 + y(2)^2));

********************************

then call this function

****************************

Tspan= 0:0.01:500; % time vector

fin = 10;

fi = cos(fin*Tspan); % external perturbation

ti=Tspan;

[T,Y]=ode45(@(t,y) myeqd(t,y,ti,fi),Tspan,[1;1;30]);

plot (T,Y(:,3))

************************************************



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.