The Neurophysiological Biomarker Toolbox (NBT)



Rossler oscillators

Uncoupled systems

%% uncoupled 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
E = 0; % 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 = 100;%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
figure
subplot(3,3,1)
plot3(x1,y1,z1,'r')
hold on
plot3(x2,y2,z2,'b')
xlabel('x')
ylabel('y')
zlabel('z')
title('Rossler Attractors in 3D space')
grid on 
axis tight
subplot(3,3,2)
plot(x1,x2, 'k')
xlabel('x1')
ylabel('x2')
hold on
grid on 
axis tight
title('Projections of the actractor of the coupled system on the plane x_{1}(t),x_{2}(t)')
subplot(3,3,3)
plot(linspace(0,100,length(Rphase)),Rphase, 'k')
xlabel('time')
ylabel('radians')
hold on
grid on 
axis tight
title('RELATIVE PHASE')

Coupled systems

E = 1; % we impose that the systems are not coupled (increasing E we increase the coupling between the two systems)
% 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 = 100;%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
hold on
subplot(3,3,4)
plot3(x1,y1,z1,'r')
hold on
plot3(x2,y2,z2,'b')
xlabel('x')
ylabel('y')
zlabel('z')
title('Rossler Attractors in 3D space')
grid on 
axis tight
subplot(3,3,5)
plot(x1,x2, 'k')
xlabel('x1')
ylabel('x2')
hold on
grid on 
axis tight
title('Projections of the actractor of the coupled system on the plane x_{1}(t),x_{2}(t)')
subplot(3,3,6)
plot(linspace(0,100,length(Rphase)),Rphase, 'k')
xlabel('time')
ylabel('radians')
hold on
grid on 
axis tight
title('RELATIVE PHASE')

Uncoupled noisy systems

% D determins the gaussian delta correlated noise term (2*D*std*randn)
D = 1;% 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 = 100;%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
hold on
subplot(3,3,7)
plot3(x1,y1,z1,'r')
hold on
plot3(x2,y2,z2,'b')
xlabel('x')
ylabel('y')
zlabel('z')
title('Rossler Attractors in 3D space')
grid on 
axis tight
subplot(3,3,8)
plot(x1,x2, 'k')
xlabel('x1')
ylabel('x2')
hold on
grid on 
axis tight
title('Projections of the actractor of the coupled system on the plane x_{1}(t),x_{2}(t)')
subplot(3,3,9)
plot(linspace(0,100,length(Rphase)),Rphase, 'k')
xlabel('time')
ylabel('radians')
hold on
grid on 
axis tight
title('RELATIVE PHASE')
tutorial/phase_locking_value/phasecode1.txt · Last modified: 2013/08/21 12:21 by Simon-Shlomo Poil
The NBTwiki platform - version 2.8 - 9 May 2013
Copyright (C) 2008-2015