figure
% noise coupled system
w1 = 1+0.015; % natural frequency of system 1
w2 = 1-0.015; % natural frequency of system 2
w = [w1 w2];
% rossler system parameters
a = 0.15;
b = 0.2;
c = 10;
% coupling constant
for E = 0:0.01:0.4; % we impose that the systems are not coupled (increasing E we increase the coupling between the two systems)
% D determins the gaussian delta correlated noise term (2*D*std*randn)
D = 0;% noise
% simulation settings
% tstart - start values of independent value (time t)
% stept - step on t-variable for Gram-Schmidt renormalization procedure.
% tend - finish value of time
stept = 2*pi/100; %time 2*pi/1000
tstart = 0;% tend
tend = 20;%time
% Number of steps
nit = round((tend-tstart)/stept);
stdData = zeros(6,1);
x0 = [1 1 1 1 1 1]; %initial condition
[T,Res,data]=nbt_runrossler(6,tstart,stept,tend,x0,100,a,b,c,E,D,w);
% Data: [x1 y1 z1 x2 y2 z2]
x1 = data(:,1);
x2 = data(:,4);
y1 = data(:,2);
y2 = data(:,5);
z1 = data(:,3);
z2 = data(:,6);
%--- instantaneous phase and frequency
phase1 = unwrap(atan2(y1,x1));% phase
phase2 = unwrap(atan2(y2,x2));
F1 = diff(phase1)/stept; % frequency expressed as time derivative of the phase
F2 = diff(phase2)/stept; % frequency expressed as time derivative of the phase
%---
n = 1;
m = 1;
%--- relative phase and relative frequency
Rphase = n*phase1-m*phase2; % relative phase
Rfreq = (n*mean(F1)-m*mean(F2)); %relative frequency
%--- Similatiry tuncion vs $\tau$
% Similarity function characterizes LAG SYNCHRONIZATION
% it means that synchronization can appean at a determined time shift;
% $\tau$ at which $S(\tau)$ is minimum can represent the shift between x1 and x2
% this shift is related to the phase difference as $\tau =
% \delta\phi/\omega$ ($\delta\phi = <\phi_{1}-\phi_{2}>$)
% if $x1 = x2 (\omega_{1} = \omega_{2})$: Complete synchronization: S(tau) reaches its
% minimum for $S(\tau) = 0$ for $\tau = 0$
% if x1 and x2 are indipendent $S(\tau)$ will be about 1 for all $\tau$
% if $S(\tau)$ has its minimum for nonzerotau it means that there is a lag
% between the two processes
%
% increasing $\epsilon$ (coupling strenght)
% the states of the systems
% become identical, but shifted in time with respect to
% each other ($S(\tau)$ has minimum for nonzerotau)
k = 1;
tau = 0:1:5;
for i = 1:length(tau)
for j = 1:length(x1)-tau(i)
S(j) = ((x2(j+tau(i))-x1(j))^2);
end
Stau(k) = mean(S)/((mean(x1.^2)*mean(x2.^2))^(1/2));
k = k+1;
end
[sigmatau taumin] = min(sqrt(Stau));
hold on
subplot(1,3,1)
hold on
plot(E,Rfreq,'r.')
ylabel('mean frequency difference')
xlabel('coupling strength')
grid on
subplot(1,3,2)
hold on
plot(E,sigmatau, 'b.')
ylabel('minimum of the Similarity Function')
xlabel('coupling strength')
grid on
subplot(1,3,3)
hold on
plot(tau*stept,sqrt(Stau))
ylabel('Similarity Function')
xlabel('tau')
axis tight
grid on
pause(0.1)
end

tutorial/phase_locking_value/phasecode2.txt · Last modified: 2012/01/09 15:54 by Giusi Schiavone