Calculate line length distributions of a recurrence plot
In the following example we use the Roessler system and the commandline RP software.
Contents
For the Roessler ODE we need to prepare a file roessler.m with the following content:
function dy=roessler(t,y, dummy, abc) dy=zeros(3,1);
if nargin < 4 a=.2; b=.2; c=5.7; else a = abc(1); b = abc(2); c = abc(3); end
dy(1)=-y(2)-y(3); dy(2)=y(1)+a*y(2); dy(3)=b+y(3)*(y(1)-c);
The commandline RP file should be copied into the current working folder. Here we use a Linux version of it with the name rp_x86_64i. You should modify accordingly to your system and version.
Line length distribution for Roessler Fig. 26A
clear options=odeset('initialstep',.01,'MaxStep',.1);
sampling time difference is 0.2
time=0:.2:2050;
integrate Roessler system roessler_abc = [0.2 0.2 5.7];
[t, x]=ode45('roessler',time,[0.1 0.4 0.3],options);
save data as 3-column vector, ASCII file
x1 = x(251:end,:); save roessler x1 -ascii -tabs
calculate the recurrence plot and cumulative line length distribution using commandline RP tool
clear, e = 0.862
unix(['./rp_x86_64i -n MAX -w 2 -i roessler -c -p roessler_hist -e ',num2str(e)]);
e = 0.8620 Used file: [1mroessler[0m (30003 data points in 3 columns read). Used parameters: embedding dimension m = 1 embedding delay t = 1 recurrence threshold e = 0.862 Theiler window w = 2 minimal diagonal line l_min = 2 minimal vertical line v_min = 2 maximum norm used Calculate recurrence points |..............................| 0% Calculate recurrence points |..............................| 1% Calculate recurrence points |*.............................| 2% Calculate recurrence points |*.............................| 3% Calculate recurrence points |*.............................| 4% Calculate recurrence points |**............................| 5% Calculate recurrence points |**............................| 6% Calculate recurrence points |**............................| 7% Calculate recurrence points |**............................| 8% Calculate recurrence points |***...........................| 9% Calculate recurrence points |***...........................| 10% Calculate recurrence points |***...........................| 11% Calculate recurrence points |****..........................| 12% Calculate recurrence points |****..........................| 13% Calculate recurrence points |****..........................| 14% Calculate recurrence points |*****.........................| 15% Calculate recurrence points |*****.........................| 16% Calculate recurrence points |*****.........................| 17% Calculate recurrence points |*****.........................| 18% Calculate recurrence points |******........................| 19% Calculate recurrence points |******........................| 20% Calculate recurrence points |******........................| 21% Calculate recurrence points |*******.......................| 22% Calculate recurrence points |*******.......................| 23% Calculate recurrence points |*******.......................| 24% Calculate recurrence points |********......................| 25% Calculate recurrence points |********......................| 26% Calculate recurrence points |********......................| 27% Calculate recurrence points |********......................| 28% Calculate recurrence points |*********.....................| 29% Calculate recurrence points |*********.....................| 30% Calculate recurrence points |*********.....................| 31% Calculate recurrence points |**********....................| 32% Calculate recurrence points |**********....................| 33% Calculate recurrence points |**********....................| 34% Calculate recurrence points |***********...................| 35% Calculate recurrence points |***********...................| 36% Calculate recurrence points |***********...................| 37% Calculate recurrence points |***********...................| 38% Calculate recurrence points |************..................| 39% Calculate recurrence points |************..................| 40% Calculate recurrence points |************..................| 41% Calculate recurrence points |*************.................| 42% Calculate recurrence points |*************.................| 43% Calculate recurrence points |*************.................| 44% Calculate recurrence points |**************................| 45% Calculate recurrence points |**************................| 46% Calculate recurrence points |**************................| 47% Calculate recurrence points |**************................| 48% Calculate recurrence points |***************...............| 49% Calculate recurrence points |***************...............| 50% Calculate recurrence points |***************...............| 51% Calculate recurrence points |****************..............| 52% Calculate recurrence points |****************..............| 53% Calculate recurrence points |****************..............| 54% Calculate recurrence points |*****************.............| 55% Calculate recurrence points |*****************.............| 56% Calculate recurrence points |*****************.............| 57% Calculate recurrence points |*****************.............| 58% Calculate recurrence points |******************............| 59% Calculate recurrence points |******************............| 60% Calculate recurrence points |******************............| 61% Calculate recurrence points |*******************...........| 62% Calculate recurrence points |*******************...........| 63% Calculate recurrence points |*******************...........| 64% Calculate recurrence points |********************..........| 65% Calculate recurrence points |********************..........| 66% Calculate recurrence points |********************..........| 67% Calculate recurrence points |********************..........| 68% Calculate recurrence points |*********************.........| 69% Calculate recurrence points |*********************.........| 70% Calculate recurrence points |*********************.........| 71% Calculate recurrence points |**********************........| 72% Calculate recurrence points |**********************........| 73% Calculate recurrence points |**********************........| 74% Calculate recurrence points |***********************.......| 75% Calculate recurrence points |***********************.......| 76% Calculate recurrence points |***********************.......| 77% Calculate recurrence points |***********************.......| 78% Calculate recurrence points |************************......| 79% Calculate recurrence points |************************......| 80% Calculate recurrence points |************************......| 81% Calculate recurrence points |*************************.....| 82% Calculate recurrence points |*************************.....| 83% Calculate recurrence points |*************************.....| 84% Calculate recurrence points |**************************....| 85% Calculate recurrence points |**************************....| 86% Calculate recurrence points |**************************....| 87% Calculate recurrence points |**************************....| 88% Calculate recurrence points |***************************...| 89% Calculate recurrence points |***************************...| 90% Calculate recurrence points |***************************...| 91% Calculate recurrence points |****************************..| 92% Calculate recurrence points |****************************..| 93% Calculate recurrence points |****************************..| 94% Calculate recurrence points |*****************************.| 95% Calculate recurrence points |*****************************.| 96% Calculate recurrence points |*****************************.| 97% Calculate recurrence points |*****************************.| 98% Calculate recurrence points |******************************| 99% Calculate recurrence points |******************************| 100% Calculate recurrence points |******************************| 100% Computation time: 0 min 2 sec Recurrence quantification analysis: RR: 0.009573 DET: 0.9717 LAM: 0.522 DET/RR: 101.5 LAM/DET: 0.5372 W_prob: 87 L_max: 404 V_max: 4 W_max: 5241 L_mean: 14.02 TT: 2.255 W_mean: 140.9 L_entr: 3.048 V_entr: 0.6153 W_entr: 3.26 DIV: 0.002475 T1: 101.9 F_min: 0.0001908 T2: 144.2
load histogram into Matlab
h=load(['roessler_hist']); p = h(:,2);
plot the histogram
clf semilogy(1:200,p(1:200,1:4:end),'k'), xlim([1 200]) xlabel('Length l (units)'), ylabel('Total number') set(gca,'xtick',[0:50:200],'xtickl',[0:50:200]), ylim([1e1 1e8])
Line length distribution for Roessler Fig. 27
integrate Roessler system
clear,options=odeset('initialstep',.01,'MaxStep',.1);
sampling time difference is 0.2
time=0:.2:2050;
Roessler with C = 9
roessler_abc = [0.1 0.1 9];
[t, x]=ode45('roessler',time,[0.1 0.4 0.3],options,roessler_abc);
save data as 3-column vector, ASCII file
x1 = x(251:end,:); save roessler9 x1 -ascii -tabs
Roessler with C = 30
roessler_abc = [0.1 0.1 30];
[t, x]=ode45('roessler',time,[0.1 0.4 0.3],options,roessler_abc);
save data as 3-column vector, ASCII file
x1 = x(251:end,:); save roessler30 x1 -ascii -tabs
calculate the recurrence plot and cumulative line length distribution using commandline RP tool, first for C = 30
clear, e = 2; unix(['./rp_x86_64i -s -n MAX -w 2 -i roessler30 -c -p roessler_hist -e ',num2str(e)]); h=load(['roessler_hist']); p(:,1) = h(:,2);
next for C = 9
unix(['./rp_x86_64i -s -n MAX -w 2 -i roessler9 -c -p roessler_hist -e ',num2str(e)]); h=load(['roessler_hist']); p(:,2) = h(:,2);
finally plot the histogram
clf semilogy(.2*(6:200),p(6:200,1),'k--'), hold on semilogy(.2*(6:200),p(6:200,2),'k-') xlabel('Length l (s)'), ylabel('Total number') yl = ylim;line([12 12],yl,'linestyle',':','color',[0 0 0]) line([24.8 24.8],yl,'linestyle',':','color',[0 0 0])