Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CRP Toolbox for MATLAB
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Norbert Marwan
CRP Toolbox for MATLAB
Commits
234cb84f
Commit
234cb84f
authored
19 years ago
by
marwan
Browse files
Options
Downloads
Patches
Plain Diff
Included plugin
parent
065fee75
No related branches found
Branches containing commit
Tags
v4.8.1.6
Tags containing commit
No related merge requests found
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
Contents.m
+2
-2
2 additions, 2 deletions
Contents.m
Readme.m
+10
-10
10 additions, 10 deletions
Readme.m
crqa.m
+212
-115
212 additions, 115 deletions
crqa.m
jrp.m
+337
-318
337 additions, 318 deletions
jrp.m
jrqa.m
+206
-95
206 additions, 95 deletions
jrqa.m
with
767 additions
and
540 deletions
Contents.m
+
2
−
2
View file @
234cb84f
% Cross Recurrence Plot Toolbox.
% Cross Recurrence Plot Toolbox.
% Version 4.8.1.
5
(R19
) 16-Ma
r-2005
% Version 4.8.1.
6
(R19
.3) 08-Ap
r-2005
%
%
% ace - Finds optimal transformation and maximal correlation.
% ace - Finds optimal transformation and maximal correlation.
% adjust - Adjusts two two-column vectors.
% adjust - Adjusts two two-column vectors.
...
@@ -51,4 +51,4 @@
...
@@ -51,4 +51,4 @@
% along with this program; if not, write to the Free Software
% along with this program; if not, write to the Free Software
% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
% Modified at
16-Ma
r-2005 1
7:19:00
by MAKEINSTALL
% Modified at
08-Ap
r-2005 1
1:03:09
by MAKEINSTALL
This diff is collapsed.
Click to expand it.
Readme.m
+
10
−
10
View file @
234cb84f
...
@@ -79,12 +79,14 @@
...
@@ -79,12 +79,14 @@
<p
align=
"left"
>
The toolbox contains
<p
align=
"left"
>
The toolbox contains
<a
href=
"http://www.mathworks.com/products/matlab/"
target=
"_blank"
>
MATLAB
</a><sup>
®
</sup>
<a
href=
"http://www.mathworks.com/products/matlab/"
target=
"_blank"
>
MATLAB
</a><sup>
®
</sup>
routines for computing recurrence
plot
s and related problems. New developments
routines for computing
<a
href=
"http://www.
recurrence
-
plot
.tk"
target=
"_blank"
>
recurrence plots
</a>
as extended recurrence quantification
and related problems. New developments
as extended recurrence quantification
(
<a
href=
"http://dx.doi.org/10.1103/PhysRevE.66.026702"
target=
"_blank"
>
Marwan et al., Phys. Rev. E, 2002
</a>
)
(
<a
href=
"http://dx.doi.org/10.1103/PhysRevE.66.026702"
target=
"_blank"
>
Marwan et al., Phys. Rev. E, 2002
</a>
)
,
and
cross recurrence plots
cross recurrence plots
(
<a
href=
"http://dx.doi.org/10.1016/S0375-9601(02)01170-2"
target=
"_blank"
>
Marwan
&
Kurths, Phys. Lett. A, 2002
</a>
;
(
<a
href=
"http://dx.doi.org/10.1016/S0375-9601(02)01170-2"
target=
"_blank"
>
Marwan
&
Kurths, Phys. Lett. A, 2002
</a>
;
<a
href=
"http://www.copernicus.org/EGU/npg/9/325.htm"
target=
"_blank"
>
Marwan et al., Nonlin. Proc. Geophys., 2002
</a>
)
<a
href=
"http://www.copernicus.org/EGU/npg/9/325.htm"
target=
"_blank"
>
Marwan et al., Nonlin. Proc. Geophys., 2002
</a>
)
and joint recurrence plots
(
<a
href=
"http://dx.doi.org/10.1016/j.physleta.2004.07.066"
target=
"_blank"
>
Romano et al., Phys. Lett. A, 2004
</a>
)
are included.
are included.
</p>
</p>
...
@@ -163,7 +165,7 @@ We plan to improve and accelerate the toolbox routines and to
...
@@ -163,7 +165,7 @@ We plan to improve and accelerate the toolbox routines and to
include further methods of nonlinear data analysis.
</p>
include further methods of nonlinear data analysis.
</p>
<p>
<p>
A plain
<a
href=
"http://www.agnld.uni-potsdam.de/~marwan/6.download/rp.php"
>
commandline version
</a>
for creation of
A plain
<a
href=
"http://www.agnld.uni-potsdam.de/~marwan/6.download/rp.php"
target=
"_blank"
>
commandline version
</a>
for creation of
recurrence plots and RQA analysis is available for some Unix/Linux
recurrence plots and RQA analysis is available for some Unix/Linux
and Dos/Windows systems.
and Dos/Windows systems.
</p>
</p>
...
@@ -182,10 +184,9 @@ last revision: <i><?PHP echo $time; ?></i>
...
@@ -182,10 +184,9 @@ last revision: <i><?PHP echo $time; ?></i>
<script
type=
"text/javascript"
>
<!--
<script
type=
"text/javascript"
>
<!--
google_ad_client
=
"
pub-0846676214263759
"
;
google_ad_client
=
"
pub-0846676214263759
"
;
google_ad_width
=
120
;
google_ad_width
=
120
;
google_ad_height
=
24
0
;
google_ad_height
=
60
0
;
google_ad_format
=
"
120x
24
0_as
"
;
google_ad_format
=
"
120x
60
0_as
"
;
google_ad_channel
=
"
2748921525
"
;
google_ad_channel
=
"
2748921525
"
;
google_page_url
=
document
.
location
;
google_color_border
=
"
669966
"
;
google_color_border
=
"
669966
"
;
google_color_bg
=
"
99CC99
"
;
google_color_bg
=
"
99CC99
"
;
google_color_link
=
"
000000
"
;
google_color_link
=
"
000000
"
;
...
@@ -194,8 +195,7 @@ google_color_text = "336633";
...
@@ -194,8 +195,7 @@ google_color_text = "336633";
//-->
</script>
//-->
</script>
<script
type=
"text/javascript"
<script
type=
"text/javascript"
src=
"http://pagead2.googlesyndication.com/pagead/show_ads.js"
>
src=
"http://pagead2.googlesyndication.com/pagead/show_ads.js"
>
</script>
</script></td></tr></table>
</td></tr></table>
<table
bgcolor=
"#FF6666"
width=
"100%"
cellpadding=
2
cellspacing=
0
border=
0
>
<table
bgcolor=
"#FF6666"
width=
"100%"
cellpadding=
2
cellspacing=
0
border=
0
>
...
...
This diff is collapsed.
Click to expand it.
crqa.m
+
212
−
115
View file @
234cb84f
...
@@ -135,6 +135,9 @@ function xout=crqa(varargin)
...
@@ -135,6 +135,9 @@ function xout=crqa(varargin)
% $Revision$
% $Revision$
%
%
% $Log$
% $Log$
% Revision 5.15 2005/04/06 13:29:12 marwan
% computation of recurrence times is now faster
%
% Revision 5.14 2005/04/06 12:59:24 marwan
% Revision 5.14 2005/04/06 12:59:24 marwan
% several small bug fixes which improves the precision
% several small bug fixes which improves the precision
%
%
...
@@ -475,7 +478,7 @@ case 'init'
...
@@ -475,7 +478,7 @@ case 'init'
'PaperPosition'
,[
0.25
0.25
7.7677
11.193
],
...
'PaperPosition'
,[
0.25
0.25
7.7677
11.193
],
...
'PaperOrientation'
,
'portrait'
,
...
'PaperOrientation'
,
'portrait'
,
...
'UserData'
,{
x
,
y
,
time_scale_flag
},
...
'UserData'
,{
x
,
y
,
time_scale_flag
},
...
'Name'
,
'Cross Recurrence Quantification Analysis'
);
'Name'
,
'Cross Recurrence Quantification Analysis'
);
set
(
0
,
'showhidden'
,
'on'
)
set
(
0
,
'showhidden'
,
'on'
)
h
=
findobj
(
'Label'
,
'&Help'
,
'Type'
,
'uimenu'
);
h
=
findobj
(
'Label'
,
'&Help'
,
'Type'
,
'uimenu'
);
...
@@ -898,130 +901,224 @@ if nogui~=2, hw=waitbar(0,['0/',num2str(Nx-w)]);set(hw,'Name','Please Wait!');h1
...
@@ -898,130 +901,224 @@ if nogui~=2, hw=waitbar(0,['0/',num2str(Nx-w)]);set(hw,'Name','Please Wait!');h1
if
strcmpi
(
method
,
'Order Pattern'
)
method
=
'op'
;
end
if
strcmpi
(
method
,
'Order Pattern'
)
method
=
'op'
;
end
if
strcmpi
(
method
,
'Order Matrx'
)
method
=
'om'
;
end
if
strcmpi
(
method
,
'Order Matrx'
)
method
=
'om'
;
end
% check if plugin exist and is executable
[
plugin_exist
,
plugin_path
]
=
is_crp_plugin
;
errcode
=
20
;
for
i
=
1
:
wstep
:
Nx
-
w
;
for
i
=
1
:
wstep
:
Nx
-
w
;
if
~
nogui
if
~
nogui
set
(
0
,
'ShowHidden'
,
'on'
)
set
(
0
,
'ShowHidden'
,
'on'
)
h
=
findobj
(
'tag'
,
'crqa_button_apply'
,
'Parent'
,
h_fig
(
1
));
h
=
findobj
(
'tag'
,
'crqa_button_apply'
,
'Parent'
,
h_fig
(
1
));
if
strcmpi
(
get
(
h
(
1
),
'string'
),
'stopped'
)
if
strcmpi
(
get
(
h
(
1
),
'string'
),
'stopped'
)
Y
(
i
:
Nx
-
w
,
1
:
6
)
=
NaN
;
Y
(
i
:
Nx
-
w
,
1
:
6
)
=
NaN
;
break
break
end
end
end
end
do_norm
=
{
'non'
;
'nor'
};
try
if
time_scale_flag
% X=crp_big(x(i:i+w-1,:),y(i:i+w-1,:),m,t,e,'fan','silent');
x_var
=
var
(
x
(
i
:
i
+
w
-
1
,
2
:
end
));
y_var
=
var
(
y
(
i
:
i
+
w
-
1
,
2
:
end
));
if
time_scale_flag
temp
=
cov
(
x
(
i
:
i
+
w
-
1
,
2
:
end
),
y
(
i
:
i
+
w
-
1
,
2
:
end
));
if
length
(
x
(
i
:
i
+
w
-
1
,:))
>
2000
else
X
=
crp_big
(
x
(
i
:
i
+
w
-
1
,:),
y
(
i
:
i
+
w
-
1
,:),
m
,
t
,
e
,
method
,
do_norm
{
nonorm
+
1
},
'silent'
);
x_var
=
var
(
x
(
i
:
i
+
w
-
1
,
1
));
y_var
=
var
(
y
(
i
:
i
+
w
-
1
,
1
));
else
temp
=
cov
(
x
(
i
:
i
+
w
-
1
,
1
),
y
(
i
:
i
+
w
-
1
,
1
));
X
=
crp
(
x
(
i
:
i
+
w
-
1
,:),
y
(
i
:
i
+
w
-
1
,:),
m
,
t
,
e
,
method
,
do_norm
{
nonorm
+
1
},
'silent'
);
end
end
xy_var
=
temp
(
1
,
2
);
else
X
=
crp2
(
x
(
i
:
i
+
w
-
1
,:),
y
(
i
:
i
+
w
-
1
,:),
m
,
t
,
e
,
method
,
do_norm
{
nonorm
+
1
},
'silent'
);
end
do_norm
=
{
'non'
;
'nor'
};
% X=crp(x(i:i+w-1,:),y(i:i+w-1,:),m,t,e,varargin{i_char},'silent');
if
time_scale_flag
% if plugin exist and method is MAX, MIN or EUC
x_var
=
var
(
x
(
i
:
i
+
w
-
1
,
2
:
end
));
y_var
=
var
(
y
(
i
:
i
+
w
-
1
,
2
:
end
));
if
plugin_exist
&
(
method_n
<
4
)
&
length
(
x
)
==
length
(
y
)
temp
=
cov
(
x
(
i
:
i
+
w
-
1
,
2
:
end
),
y
(
i
:
i
+
w
-
1
,
2
:
end
));
else
errcode
=
21
;
x_var
=
var
(
x
(
i
:
i
+
w
-
1
,
1
));
y_var
=
var
(
y
(
i
:
i
+
w
-
1
,
1
));
warning
off
temp
=
cov
(
x
(
i
:
i
+
w
-
1
,
1
),
y
(
i
:
i
+
w
-
1
,
1
));
tmp_xdatafile
=
tempname
;
end
tmp_ydatafile
=
tempname
;
xy_var
=
temp
(
1
,
2
);
tmp_rqadatafile
=
tempname
;
% normalize data if necessary
if
nonorm
x
=
(
x
-
repmat
(
mean
(
x
),
length
(
x
),
1
))
.
/
repmat
(
std
(
x
),
length
(
x
),
1
);
y
=
(
y
-
repmat
(
mean
(
y
),
length
(
y
),
1
))
.
/
repmat
(
std
(
y
),
length
(
y
),
1
);
end
x_tmp
=
x
(
i
:
i
+
w
-
1
,:);
y_tmp
=
y
(
i
:
i
+
w
-
1
,:);
% save data in temporary file
save
(
tmp_xdatafile
,
'x_tmp'
,
'-ascii'
,
'-tabs'
);
save
(
tmp_ydatafile
,
'y_tmp'
,
'-ascii'
,
'-tabs'
);
% call extern rp programme
m_str
=
{
'MAX'
,
'EUC'
,
'MIN'
};
[
status
]
=
system
([
plugin_path
,
filesep
,
'rp -m '
,
num2str
(
m
),
...
' -t '
,
num2str
(
t
),
...
' -e '
,
num2str
(
e
),
...
' -n '
,
m_str
{
method_n
},
...
' -w '
,
num2str
(
theiler_window
),
...
' -i '
,
tmp_xdatafile
,
...
' -j '
,
tmp_ydatafile
,
...
' -o '
,
tmp_rqadatafile
,
...
' -s'
]);
errcode
=
22
;
% import RQA
rqa_in
=
[];
try
fid
=
fopen
(
tmp_rqadatafile
,
'r'
);
% open RQA data file
while
1
dataStr
=
fgetl
(
fid
);
% read RQA data
if
~
ischar
(
dataStr
),
break
,
end
% leave the loop if end of file
if
isempty
(
findstr
(
dataStr
,
'#'
))
% neglect comments line (e.g. header)
rqa_in
=
str2num
(
dataStr
);
% import RQA measures into local variable rqa
end
end
fclose
(
fid
);
% close RQA data file
RR
=
rqa_in
(
1
);
DET
=
rqa_in
(
2
);
LAM
=
rqa_in
(
4
);
Lmax
=
rqa_in
(
6
);
L
=
rqa_in
(
7
);
ENTR
=
rqa_in
(
8
);
Vmax
=
rqa_in
(
10
);
TT
=
rqa_in
(
11
);
t1
=
rqa_in
(
13
);
t2
=
rqa_in
(
14
);
warning
off
delete
(
tmp_rqadatafile
);
delete
(
tmp_xdatafile
);
delete
(
tmp_ydatafile
);
warning
on
catch
warning
off
delete
(
tmp_rqadatafile
);
delete
(
tmp_xdatafile
);
delete
(
tmp_ydatafile
);
warning
on
end
warning
off
if
nogui
~=
2
&
ishandle
(
h1
),
set
(
h1
,
'str'
,[
num2str
(
i
),
'/'
,
num2str
(
Nx
-
w
)]);
waitbar
(
i
/(
Nx
-
w
));
drawnow
,
end
%if 0
if
nogui
~=
2
&
ishandle
(
h1
),
set
(
h1
,
'str'
,[
num2str
(
i
),
'/'
,
num2str
(
Nx
-
w
)]);
waitbar
(
i
/(
Nx
-
w
));
drawnow
,
end
catch
error
(
lasterr
)
if
nogui
~=
2
&
ishandle
(
hw
),
close
(
hw
),
end
end
N
=
size
(
X
);
if
theiler_window
>
0
X_theiler
=
double
(
triu
(
X
,
theiler_window
))
+
double
(
tril
(
X
,
-
theiler_window
));
else
X_theiler
=
X
;
end
errcode
=
20
;
% compute recurrence times of 1st and 2nd type
% use builtin implementation
if
size
(
X_theiler
,
2
)
>
1000
else
t1
=
[];
t2
=
[];
rps2
=
find
(
diff
(
double
(
X_theiler
(:)))
==
1
);
errcode
=
25
;
rps
=
find
(
X_theiler
(:));
try
t1
=
diff
(
rps
);
% X=crp_big(x(i:i+w-1,:),y(i:i+w-1,:),m,t,e,'fan','silent');
t2
=
diff
(
rps2
);
if
time_scale_flag
else
if
length
(
x
(
i
:
i
+
w
-
1
,:))
>
2000
t1
=
[];
t2
=
[];
X
=
crp_big
(
x
(
i
:
i
+
w
-
1
,:),
y
(
i
:
i
+
w
-
1
,:),
m
,
t
,
e
,
method
,
do_norm
{
nonorm
+
1
},
'silent'
);
for
i2
=
1
:
size
(
X_theiler
,
2
)
else
if
(
Nx
-
w
<
2
),
waitbar
(
i2
/
size
(
X_theiler
,
2
)),
end
X
=
crp
(
x
(
i
:
i
+
w
-
1
,:),
y
(
i
:
i
+
w
-
1
,:),
m
,
t
,
e
,
method
,
do_norm
{
nonorm
+
1
},
'silent'
);
rps2
=
find
(
diff
(
double
(
X_theiler
(:,
i2
)))
==
1
);
end
rps
=
find
(
X_theiler
(:,
i2
));
else
t1
=
[
t1
;
diff
(
rps
)];
X
=
crp2
(
x
(
i
:
i
+
w
-
1
,:),
y
(
i
:
i
+
w
-
1
,:),
m
,
t
,
e
,
method
,
do_norm
{
nonorm
+
1
},
'silent'
);
t2
=
[
t2
;
diff
(
rps2
)];
end
end
% X=crp(x(i:i+w-1,:),y(i:i+w-1,:),m,t,e,varargin{i_char},'silent');
end
t1
=
mean
(
t1
);
warning
off
t2
=
mean
(
t2
);
if
nogui
~=
2
&
ishandle
(
h1
),
set
(
h1
,
'str'
,[
num2str
(
i
),
'/'
,
num2str
(
Nx
-
w
)]);
waitbar
(
i
/(
Nx
-
w
));
drawnow
,
end
[
a
b
]
=
dl
(
X_theiler
);
%if 0
catch
warning
off
error
(
lasterr
)
errcode
=
201
;
if
nogui
~=
2
&
ishandle
(
hw
),
close
(
hw
),
end
b
(
find
(
b
<
lmin
))
=
[];
end
[
c
d
]
=
tt
(
X_theiler
);
warning
off
errcode
=
202
;
d
(
find
(
d
<
vmin
))
=
[];
errcode
=
203
;
RR
=
sum
(
X_theiler
(:))/(
N
(
1
)
*
N
(
2
));
%b(find(b>=max(N)-lmin))=[]; if isempty(b), b=0; end
if
isempty
(
b
),
b
=
0
;
end
errcode
=
204
;
if
sum
(
sum
(
X_theiler
))
>
0
DET
=
sum
(
b
)/
sum
(
sum
(
X_theiler
));
else
DET
=
NaN
;
end
errcode
=
205
;
L
=
mean
(
b
);
histL
=
hist
(
b
(:),[
1
:
min
(
N
)]);
ENTR
=
entropy
(
histL
(:));
errcode
=
206
;
if
sum
(
d
)
>
0
LAM
=
sum
(
d
)/
sum
(
sum
(
X_theiler
));
else
LAM
=
NaN
;
end
errcode
=
207
;
N
=
size
(
X
);
TT
=
mean
(
d
);
if
theiler_window
>
0
b
=
[
b
;
0
];
Lmax
=
max
(
b
);
X_theiler
=
double
(
triu
(
X
,
theiler_window
))
+
double
(
tril
(
X
,
-
theiler_window
));
d
=
[
d
;
0
];
Vmax
=
max
(
d
);
else
warning
on
X_theiler
=
X
;
end
errcode
=
208
;
Y
(
i
,
1
)
=
RR
;
errcode
=
26
;
Y
(
i
,
2
)
=
DET
;
Y
(
i
,
3
)
=
L
;
% compute recurrence times of 1st and 2nd type
Y
(
i
,
4
)
=
Lmax
;
if
size
(
X_theiler
,
2
)
>
1000
Y
(
i
,
5
)
=
ENTR
;
t1
=
[];
t2
=
[];
Y
(
i
,
6
)
=
LAM
;
rps2
=
find
(
diff
(
double
(
X_theiler
(:)))
==
1
);
Y
(
i
,
7
)
=
TT
;
rps
=
find
(
X_theiler
(:));
Y
(
i
,
8
)
=
Vmax
;
t1
=
diff
(
rps
);
Y
(
i
,
9
)
=
t1
;
t2
=
diff
(
rps2
);
Y
(
i
,
10
)
=
t2
;
else
Y
(
i
,
11
)
=
x_var
;
t1
=
[];
t2
=
[];
Y
(
i
,
12
)
=
y_var
;
for
i2
=
1
:
size
(
X_theiler
,
2
)
Y
(
i
,
13
)
=
xy_var
;
if
(
Nx
-
w
<
2
),
waitbar
(
i2
/
size
(
X_theiler
,
2
)),
end
end
rps2
=
find
(
diff
(
double
(
X_theiler
(:,
i2
)))
==
1
);
if
nogui
~=
2
&
ishandle
(
hw
),
waitbar
(
1
);
drawnow
;
close
(
hw
),
end
rps
=
find
(
X_theiler
(:,
i2
));
t1
=
[
t1
;
diff
(
rps
)];
t2
=
[
t2
;
diff
(
rps2
)];
end
end
t1
=
mean
(
t1
);
t2
=
mean
(
t2
);
errcode
=
27
;
[
a
b
]
=
dl
(
X_theiler
);
warning
off
errcode
=
271
;
b
(
find
(
b
<
lmin
))
=
[];
[
c
d
]
=
tt
(
X_theiler
);
warning
off
errcode
=
272
;
d
(
find
(
d
<
vmin
))
=
[];
errcode
=
273
;
RR
=
sum
(
X_theiler
(:))/(
N
(
1
)
*
N
(
2
));
%b(find(b>=max(N)-lmin))=[]; if isempty(b), b=0; end
if
isempty
(
b
),
b
=
0
;
end
errcode
=
274
;
if
sum
(
sum
(
X_theiler
))
>
0
DET
=
sum
(
b
)/
sum
(
sum
(
X_theiler
));
else
DET
=
NaN
;
end
errcode
=
275
;
L
=
mean
(
b
);
histL
=
hist
(
b
(:),[
1
:
min
(
N
)]);
ENTR
=
entropy
(
histL
(:));
errcode
=
276
;
if
sum
(
d
)
>
0
LAM
=
sum
(
d
)/
sum
(
sum
(
X_theiler
));
else
LAM
=
NaN
;
end
errcode
=
277
;
TT
=
mean
(
d
);
b
=
[
b
;
0
];
Lmax
=
max
(
b
);
d
=
[
d
;
0
];
Vmax
=
max
(
d
);
end
% end plugin
warning
on
errcode
=
28
;
Y
(
i
,
1
)
=
RR
;
Y
(
i
,
2
)
=
DET
;
Y
(
i
,
3
)
=
L
;
Y
(
i
,
4
)
=
Lmax
;
Y
(
i
,
5
)
=
ENTR
;
Y
(
i
,
6
)
=
LAM
;
Y
(
i
,
7
)
=
TT
;
Y
(
i
,
8
)
=
Vmax
;
Y
(
i
,
9
)
=
t1
;
Y
(
i
,
10
)
=
t2
;
Y
(
i
,
11
)
=
x_var
;
Y
(
i
,
12
)
=
y_var
;
Y
(
i
,
13
)
=
xy_var
;
end
% end window loop
if
nogui
~=
2
&
ishandle
(
hw
),
waitbar
(
1
);
drawnow
;
close
(
hw
),
end
% close waitbar
if
~
nogui
if
~
nogui
h
=
findobj
(
'tag'
,
'crqa_button_apply'
);
h
=
findobj
(
'tag'
,
'crqa_button_apply'
);
...
@@ -1114,7 +1211,7 @@ end
...
@@ -1114,7 +1211,7 @@ end
%if 0
%if 0
catch
catch
if
nogui
~=
2
,
if
ishandle
(
hw
),
close
(
hw
),
end
,
end
if
nogui
~=
2
,
if
ishandle
(
hw
),
close
(
hw
),
end
,
end
z
=
whos
;
x
=
lasterr
;
y
=
lastwarn
;
in
=
varargin
{
1
};
z
=
whos
;
x
=
lasterr
;
y
=
lastwarn
;
in
=
varargin
{
1
};
print_error
(
'crqa'
,
z
,
x
,
y
,
in
,
method
,
action
)
print_error
(
'crqa'
,
z
,
x
,
y
,
in
,
method
,
action
)
try
,
if
~
nogui
try
,
if
~
nogui
...
...
This diff is collapsed.
Click to expand it.
jrp.m
+
337
−
318
View file @
234cb84f
This diff is collapsed.
Click to expand it.
jrqa.m
+
206
−
95
View file @
234cb84f
...
@@ -116,6 +116,9 @@ function xout=jrqa(varargin)
...
@@ -116,6 +116,9 @@ function xout=jrqa(varargin)
% $Revision$
% $Revision$
%
%
% $Log$
% $Log$
% Revision 1.1 2005/03/16 16:22:29 marwan
% support for joint recurrence plots added
%
%
%
%
%
% This program is part of the new generation XXII series.
% This program is part of the new generation XXII series.
...
@@ -848,6 +851,12 @@ if nogui~=2, hw=waitbar(0,['0/',num2str(Nx-w)]);set(hw,'Name','Please Wait!');h1
...
@@ -848,6 +851,12 @@ if nogui~=2, hw=waitbar(0,['0/',num2str(Nx-w)]);set(hw,'Name','Please Wait!');h1
if
strcmpi
(
method
,
'Order Pattern'
)
method
=
'op'
;
end
if
strcmpi
(
method
,
'Order Pattern'
)
method
=
'op'
;
end
if
strcmpi
(
method
,
'Order Matrx'
)
method
=
'om'
;
end
if
strcmpi
(
method
,
'Order Matrx'
)
method
=
'om'
;
end
% check if plugin exist and is executable
[
plugin_exist
,
plugin_path
]
=
is_crp_plugin
;
errcode
=
20
;
for
i
=
1
:
wstep
:
Nx
-
w
;
for
i
=
1
:
wstep
:
Nx
-
w
;
if
~
nogui
if
~
nogui
set
(
0
,
'ShowHidden'
,
'on'
)
set
(
0
,
'ShowHidden'
,
'on'
)
...
@@ -858,105 +867,207 @@ for i=1:wstep:Nx-w;
...
@@ -858,105 +867,207 @@ for i=1:wstep:Nx-w;
end
end
end
end
do_norm
=
{
'non'
;
'nor'
};
if
time_scale_flag
x_var
=
var
(
x
(
i
:
i
+
w
-
1
,
2
:
end
));
y_var
=
var
(
y
(
i
:
i
+
w
-
1
,
2
:
end
));
temp
=
cov
(
x
(
i
:
i
+
w
-
1
,
2
:
end
),
y
(
i
:
i
+
w
-
1
,
2
:
end
));
else
x_var
=
var
(
x
(
i
:
i
+
w
-
1
,
1
));
y_var
=
var
(
y
(
i
:
i
+
w
-
1
,
1
));
temp
=
cov
(
x
(
i
:
i
+
w
-
1
,
1
),
y
(
i
:
i
+
w
-
1
,
1
));
end
xy_var
=
temp
(
1
,
2
);
do_norm
=
{
'non'
;
'nor'
};
% if plugin exist and method is MAX, MIN or EUC
if
plugin_exist
&
(
method_n
<
4
)
&
length
(
x
)
==
length
(
y
)
errcode
=
21
;
warning
off
tmp_xdatafile
=
tempname
;
tmp_ydatafile
=
tempname
;
tmp_rqadatafile
=
tempname
;
% normalize data if necessary
if
nonorm
x
=
(
x
-
repmat
(
mean
(
x
),
length
(
x
),
1
))
.
/
repmat
(
std
(
x
),
length
(
x
),
1
);
y
=
(
y
-
repmat
(
mean
(
y
),
length
(
y
),
1
))
.
/
repmat
(
std
(
y
),
length
(
y
),
1
);
end
x_tmp
=
x
(
i
:
i
+
w
-
1
,:);
y_tmp
=
y
(
i
:
i
+
w
-
1
,:);
% save data in temporary file
save
(
tmp_xdatafile
,
'x_tmp'
,
'-ascii'
,
'-tabs'
);
save
(
tmp_ydatafile
,
'y_tmp'
,
'-ascii'
,
'-tabs'
);
% call extern rp programme
m_str
=
{
'MAX'
,
'EUC'
,
'MIN'
};
[
status
]
=
system
([
plugin_path
,
filesep
,
'rp -m '
,
num2str
(
m
),
...
' -t '
,
num2str
(
t
),
...
' -e '
,
num2str
(
e
),
...
' -n '
,
m_str
{
method_n
},
...
' -w '
,
num2str
(
theiler_window
),
...
' -i '
,
tmp_xdatafile
,
...
' -j '
,
tmp_ydatafile
,
...
' -o '
,
tmp_rqadatafile
,
...
' -J '
,
...
' -s'
]);
errcode
=
22
;
% import RQA
rqa_in
=
[];
try
fid
=
fopen
(
tmp_rqadatafile
,
'r'
);
% open RQA data file
while
1
dataStr
=
fgetl
(
fid
);
% read RQA data
if
~
ischar
(
dataStr
),
break
,
end
% leave the loop if end of file
if
isempty
(
findstr
(
dataStr
,
'#'
))
% neglect comments line (e.g. header)
rqa_in
=
str2num
(
dataStr
);
% import RQA measures into local variable rqa
end
end
fclose
(
fid
);
% close RQA data file
RR
=
rqa_in
(
1
);
DET
=
rqa_in
(
2
);
LAM
=
rqa_in
(
4
);
Lmax
=
rqa_in
(
6
);
L
=
rqa_in
(
7
);
ENTR
=
rqa_in
(
8
);
Vmax
=
rqa_in
(
10
);
TT
=
rqa_in
(
11
);
t1
=
rqa_in
(
13
);
t2
=
rqa_in
(
14
);
warning
off
delete
(
tmp_rqadatafile
);
delete
(
tmp_xdatafile
);
delete
(
tmp_ydatafile
);
warning
on
catch
warning
off
delete
(
tmp_rqadatafile
);
delete
(
tmp_xdatafile
);
delete
(
tmp_ydatafile
);
warning
on
end
try
if
nogui
~=
2
&
ishandle
(
h1
),
set
(
h1
,
'str'
,[
num2str
(
i
),
'/'
,
num2str
(
Nx
-
w
)]);
waitbar
(
i
/(
Nx
-
w
));
drawnow
,
end
% X=crp_big(x(i:i+w-1,:),y(i:i+w-1,:),m,t,e,'fan','silent');
if
time_scale_flag
if
length
(
x
(
i
:
i
+
w
-
1
,:))
>
2000
Xx
=
crp_big
(
x
(
i
:
i
+
w
-
1
,:),
m
,
t
,
e
,
method
,
do_norm
{
nonorm
+
1
},
'silent'
);
Xy
=
crp_big
(
y
(
i
:
i
+
w
-
1
,:),
m
,
t
,
e
,
method
,
do_norm
{
nonorm
+
1
},
'silent'
);
X
=
Xx
.*
Xy
;
else
X
=
jrp
(
x
(
i
:
i
+
w
-
1
,:),
y
(
i
:
i
+
w
-
1
,:),
m
,
t
,
e
,
method
,
do_norm
{
nonorm
+
1
},
'silent'
);
end
else
Xx
=
crp2
(
x
(
i
:
i
+
w
-
1
,:),
m
,
t
,
e
,
method
,
do_norm
{
nonorm
+
1
},
'silent'
);
Xy
=
crp2
(
y
(
i
:
i
+
w
-
1
,:),
m
,
t
,
e
,
method
,
do_norm
{
nonorm
+
1
},
'silent'
);
X
=
Xx
.*
Xy
;
end
% X=crp(x(i:i+w-1,:),y(i:i+w-1,:),m,t,e,varargin{i_char},'silent');
if
time_scale_flag
x_var
=
var
(
x
(
i
:
i
+
w
-
1
,
2
:
end
));
y_var
=
var
(
y
(
i
:
i
+
w
-
1
,
2
:
end
));
temp
=
cov
(
x
(
i
:
i
+
w
-
1
,
2
:
end
),
y
(
i
:
i
+
w
-
1
,
2
:
end
));
else
x_var
=
var
(
x
(
i
:
i
+
w
-
1
,
1
));
y_var
=
var
(
y
(
i
:
i
+
w
-
1
,
1
));
temp
=
cov
(
x
(
i
:
i
+
w
-
1
,
1
),
y
(
i
:
i
+
w
-
1
,
1
));
end
xy_var
=
temp
(
1
,
2
);
warning
off
if
nogui
~=
2
&
ishandle
(
h1
),
set
(
h1
,
'str'
,[
num2str
(
i
),
'/'
,
num2str
(
Nx
-
w
)]);
waitbar
(
i
/(
Nx
-
w
));
drawnow
,
end
%if 0
catch
error
(
lasterr
)
if
nogui
~=
2
&
ishandle
(
hw
),
close
(
hw
),
end
end
errcode
=
20
;
% use builtin implementation
t1
=
[
0
];
t2
=
[];
else
for
i2
=
1
:
size
(
X
,
2
)
errcode
=
25
;
rps2
=
find
(
diff
(
double
(
X
(:,
i2
)))
==
1
);
% try
rps
=
find
(
X
(:,
i2
));
% X=crp_big(x(i:i+w-1,:),y(i:i+w-1,:),m,t,e,'fan','silent');
t1
=
[
t1
;
diff
(
rps
)];
if
time_scale_flag
t2
=
[
t2
;
diff
(
rps2
)];
if
length
(
x
(
i
:
i
+
w
-
1
,:))
>
2000
end
Xx
=
crp_big
(
x
(
i
:
i
+
w
-
1
,:),
m
,
t
,
e
,
method
,
do_norm
{
nonorm
+
1
},
'silent'
);
t1
=
mean
(
t1
);
Xy
=
crp_big
(
y
(
i
:
i
+
w
-
1
,:),
m
,
t
,
e
,
method
,
do_norm
{
nonorm
+
1
},
'silent'
);
t2
=
mean
(
t2
);
X
=
Xx
.*
Xy
;
else
N
=
size
(
X
);
X
=
jrp
(
x
(
i
:
i
+
w
-
1
,:),
y
(
i
:
i
+
w
-
1
,:),
m
,
t
,
e
,
method
,
do_norm
{
nonorm
+
1
},
'silent'
);
X_theiler
=
double
(
triu
(
X
,
theiler_window
))
+
double
(
tril
(
X
,
-
theiler_window
));
end
else
[
a
b
]
=
dl
(
X_theiler
);
Xx
=
crp2
(
x
(
i
:
i
+
w
-
1
,:),
m
,
t
,
e
,
method
,
do_norm
{
nonorm
+
1
},
'silent'
);
warning
off
Xy
=
crp2
(
y
(
i
:
i
+
w
-
1
,:),
m
,
t
,
e
,
method
,
do_norm
{
nonorm
+
1
},
'silent'
);
errcode
=
201
;
X
=
Xx
.*
Xy
;
b
(
find
(
b
<=
lmin
))
=
[];
end
[
c
d
]
=
tt
(
X
);
% X=crp(x(i:i+w-1,:),y(i:i+w-1,:),m,t,e,varargin{i_char},'silent');
warning
off
errcode
=
202
;
warning
off
d
(
find
(
d
<=
vmin
))
=
[];
if
nogui
~=
2
&
ishandle
(
h1
),
set
(
h1
,
'str'
,[
num2str
(
i
),
'/'
,
num2str
(
Nx
-
w
)]);
waitbar
(
i
/(
Nx
-
w
));
drawnow
,
end
errcode
=
203
;
if
0
RR
=
sum
(
X_theiler
(:))/(
N
(
1
)
*
N
(
2
));
% catch
%b(find(b>=max(N)-lmin))=[]; if isempty(b), b=0; end
error
(
lasterr
)
b
(
find
(
b
>=
max
(
N
)))
=
[];
if
isempty
(
b
),
b
=
0
;
end
if
nogui
~=
2
&
ishandle
(
hw
),
close
(
hw
),
end
errcode
=
204
;
end
if
sum
(
sum
(
X_theiler
))
>
0
DET
=
sum
(
b
)/
sum
(
sum
(
X_theiler
));
N
=
size
(
X
);
else
if
theiler_window
>
0
DET
=
NaN
;
X_theiler
=
double
(
triu
(
X
,
theiler_window
))
+
double
(
tril
(
X
,
-
theiler_window
));
end
else
errcode
=
205
;
X_theiler
=
X
;
L
=
mean
(
b
);
end
histL
=
hist
(
b
(:));
ENTR
=
entropy
(
histL
(:));
errcode
=
26
;
errcode
=
206
;
if
sum
(
d
)
>
0
% compute recurrence times of 1st and 2nd type
LAM
=
sum
(
d
)/
sum
(
sum
(
X
));
if
size
(
X_theiler
,
2
)
>
1000
else
t1
=
[];
t2
=
[];
LAM
=
NaN
;
rps2
=
find
(
diff
(
double
(
X_theiler
(:)))
==
1
);
end
rps
=
find
(
X_theiler
(:));
errcode
=
207
;
t1
=
diff
(
rps
);
TT
=
mean
(
d
);
t2
=
diff
(
rps2
);
b
=
[
b
;
0
];
Lmax
=
max
(
b
);
else
d
=
[
d
;
0
];
Vmax
=
max
(
d
);
t1
=
[];
t2
=
[];
warning
on
for
i2
=
1
:
size
(
X_theiler
,
2
)
if
(
Nx
-
w
<
2
),
waitbar
(
i2
/
size
(
X_theiler
,
2
)),
end
errcode
=
208
;
rps2
=
find
(
diff
(
double
(
X_theiler
(:,
i2
)))
==
1
);
Y
(
i
,
1
)
=
RR
;
rps
=
find
(
X_theiler
(:,
i2
));
Y
(
i
,
2
)
=
DET
;
t1
=
[
t1
;
diff
(
rps
)];
Y
(
i
,
3
)
=
L
;
t2
=
[
t2
;
diff
(
rps2
)];
Y
(
i
,
4
)
=
Lmax
;
end
Y
(
i
,
5
)
=
ENTR
;
end
Y
(
i
,
6
)
=
LAM
;
t1
=
mean
(
t1
);
Y
(
i
,
7
)
=
TT
;
t2
=
mean
(
t2
);
Y
(
i
,
8
)
=
Vmax
;
Y
(
i
,
9
)
=
t1
;
errcode
=
27
;
Y
(
i
,
10
)
=
t2
;
[
a
b
]
=
dl
(
X_theiler
);
Y
(
i
,
11
)
=
x_var
;
Y
(
i
,
12
)
=
y_var
;
warning
off
Y
(
i
,
13
)
=
xy_var
;
errcode
=
271
;
b
(
find
(
b
<
lmin
))
=
[];
[
c
d
]
=
tt
(
X_theiler
);
warning
off
errcode
=
272
;
d
(
find
(
d
<
vmin
))
=
[];
errcode
=
273
;
RR
=
sum
(
X_theiler
(:))/(
N
(
1
)
*
N
(
2
));
%b(find(b>=max(N)-lmin))=[]; if isempty(b), b=0; end
if
isempty
(
b
),
b
=
0
;
end
errcode
=
274
;
if
sum
(
sum
(
X_theiler
))
>
0
DET
=
sum
(
b
)/
sum
(
sum
(
X_theiler
));
else
DET
=
NaN
;
end
errcode
=
275
;
L
=
mean
(
b
);
histL
=
hist
(
b
(:),[
1
:
min
(
N
)]);
ENTR
=
entropy
(
histL
(:));
errcode
=
276
;
if
sum
(
d
)
>
0
LAM
=
sum
(
d
)/
sum
(
sum
(
X_theiler
));
else
LAM
=
NaN
;
end
errcode
=
277
;
TT
=
mean
(
d
);
b
=
[
b
;
0
];
Lmax
=
max
(
b
);
d
=
[
d
;
0
];
Vmax
=
max
(
d
);
end
% end plugin
warning
on
errcode
=
208
;
Y
(
i
,
1
)
=
RR
;
Y
(
i
,
2
)
=
DET
;
Y
(
i
,
3
)
=
L
;
Y
(
i
,
4
)
=
Lmax
;
Y
(
i
,
5
)
=
ENTR
;
Y
(
i
,
6
)
=
LAM
;
Y
(
i
,
7
)
=
TT
;
Y
(
i
,
8
)
=
Vmax
;
Y
(
i
,
9
)
=
t1
;
Y
(
i
,
10
)
=
t2
;
Y
(
i
,
11
)
=
x_var
;
Y
(
i
,
12
)
=
y_var
;
Y
(
i
,
13
)
=
xy_var
;
end
end
if
nogui
~=
2
&
ishandle
(
hw
),
waitbar
(
1
);
drawnow
;
close
(
hw
),
end
if
nogui
~=
2
&
ishandle
(
hw
),
waitbar
(
1
);
drawnow
;
close
(
hw
),
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment