Calculation of PSI in MATLAB requires the installation of the Circular Statistics library from:
Philipp Berens (2022) Circular Statistics Toolbox (Directional Statistics) (https://www.mathworks.com/matlabcentral/fileexchange/10676-circular-stat...), MATLAB Central File Exchange.
%% Script to Compute PSI from S-AMPH data tA
% Compute AM phase using Hilbert transform
for band = 1:5
for AM = 1:3
phase(:,AM,band) = angle(hilbert(tA(:,AM,band)));
end
end
% Compute PSI for 2 phase series with DIFFERENT frequencies (e.g. ratio of 2:1)
n = 1;
m = 2;
x = phase(:,2,1); % choose desired AM (1=stress, 2=syll, 3=phoneme), choose desired frequency band (1-5)
y = phase(:,1,1);
nmPSI = abs(mean(exp(1i*(circ_dist(n*x,m*y)))));