Search All of the Math Forum:

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: How should I plot error graph ?
Replies: 0

 aniket Posts: 23 Registered: 1/15/13
How should I plot error graph ?
Posted: Feb 5, 2013 1:41 PM

Hello,

I have implemented adaptive hopf oscillator with ode45 solver. This oscillator adapts the frequency of external input signal. Now i want to plot error graph between input frequency and output frequency

i.e E = Win - Wout

Win = external input frquency

Wout = adapted frequency by oscillator

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

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

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

ti=Tspan;

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

plot (T,Y(:,3))

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

here fi is external input signal.

and In function y(3) is internal frequency of oscillator and it is adapted to external frequency. I want to plot error graph for this.

K is coupling strength ... (if it is high adaptation is quicker)

this error graph maybe with respect to parameter value K or i think with respect to time ?

How should i do this ?

Thank You