Cross Recurrence Plot Toolbox v5.29 (R38)

CRP Toolbox

microstates

Set of microstates from a recurrence plot.

Syntax

m=microstates(x)
[m,p]=microstates(x)
[m,p]=microstates(x,k)

Description

m=microstates(x) finds matrix m of all microstates from recurrence matrix x. Microstates are numbered from 1 to N, where N is the max. number of available microstates. Per default microstates have size k=2, thus N = 16.

[m,p]=microstates(x) further provides the set of microstate patterns in p as a (2 × 2 × N) matrix. The microstate index in m corresponds to the pattern index in the 3rd dimension.

...=microstates(x,k) uses microstates of size k x k. The total number of microstates is N = k(2k).

Examples

a = sin(linspace(0,5*2*pi,1050)); % sine
b = rand(1000,1); % noise
Xa = crp(a,2,50,.2,'nonorm','nogui'); % recurrence plot for sine
Xb = crp(b,1,1,.2,'nonorm','nogui'); % recurrence plot for noise
K = 3; % size of microstates
[Ma, P] = microstates(Xa, K); % microstates for sine
Mb = microstates(Xb, K); % microstates for noise
Ha = hist(Ma(:), 1:2^(K^2)); % histogram of microstates for sine
Hb = hist(Mb(:), 1:2^(K^2)); % histogram of microstates for noise
 
% show microstates histograms
subplot(2,1,1)
bar(log10(Ha))
ylabel('Frequency')
title('Histogram microstates sine')

subplot(2,1,2)
bar(log10(Hb))
ylabel('Frequency'), xlabel('Microstate index')
title('Histogram microstates noise')

% show most frequent microstates
[~, idx] = sort(Ha, 'desc'); % sorted histogram
clf
for i = 1:16
  subplot(4,4,i)
  imagesc(P(:,:,idx(i))), caxis([0 1])
  title(sprintf('Percentage: %2.2f', 100*Ha(idx(i))/sum(Ha)))
end
colormap([1 1 1; 0 0 0])
sgtitle('Most frequent microstates')

See Also

crqa, dl, tt

References

Corso, F., et al.: Quantifying entropy using recurrence matrix microstates, Chaos, 28, 2018.