%% Phase synchronization between the two channels load('Phase_sample.mat') phase_vals = double(phase_vals); % Extract the phase values: e1_phase = phase_vals(1,:); e2_phase = phase_vals(2,:); n_phase = size(phase_vals,2); % Difference between e1 and e2: diff_phase = % Projecting the diffrence in to complex plain cmx_phase = % Average in complex space mean_cm_phase = % Length of the mean vector ispc = figure(1),clf set(gcf, 'color','w', 'WindowState', 'maximize'); polarplot([zeros(1,n_phase); angle(cmx_phase)] , [zeros(1,n_phase);ones(1,n_phase)],'LineWidth',1,Color='k'), hold on polarplot([zeros(1,1); angle(mean_cm_phase)] , [zeros(1,1);ispc(1,1)],'LineWidth',5,Color='g') set(gca,'FontSize',20,'LineWidth',3) title('ISPC') %% IPSC in one line of code ispc = figure(2),clf set(gcf, 'color','w', 'WindowState', 'maximize'); polarplot([zeros(1,n_phase); angle(cmx_phase)] , [zeros(1,n_phase);ones(1,n_phase)],'LineWidth',1,Color='k'), hold on polarplot([zeros(1,1); angle(mean_cm_phase)] , [zeros(1,1);ispc(1,1)],'LineWidth',5,Color='g') set(gca,'FontSize',20,'LineWidth',3) title('ISPC - one line')