Newer
Older
% 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');
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');
end
% X=crp(x(i:i+w-1,:),y(i:i+w-1,:),m,t,e,varargin{i_char},'silent');
warning off
if nogui~=2 & ishandle(h1), set(h1,'str',[num2str(i),'/',num2str(Nx-w)]); waitbar(i/(Nx-w)); drawnow, end
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
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=26;
% compute recurrence times of 1st and 2nd type
if size(X_theiler,2) > 1000
t1=[];t2=[];
rps2=find(diff(double(X_theiler(:)))==1);
rps=find(X_theiler(:));
t1=diff(rps);
t2=diff(rps2);
else
t1 = []; t2 = [];
for i2=1:size(X_theiler,2)
if(Nx-w < 2), waitbar(i2/size(X_theiler,2)), end
rps2=find(diff(double(X_theiler(:,i2)))==1);
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=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;
if nogui~=2 & ishandle(hw), waitbar(1); drawnow; close(hw), end
if ~nogui
set(h_button_apply(1),'ToolTip','Starts the computation.','String','Apply','Callback','jrqa compute')
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
for j=1:length(obj);
h=findobj('Tag',obj{j},'Parent',h_fig(1));
if ~isempty(h)
set(h,'Enable','On')
end
end
end
if ~nogui,
h=findobj('Tag','crqa_Fig');
if ~isempty(h), set(0,'CurrentFigure',h(1)); end
setptr(gcf,'arrow'),
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% plot
if ~nogui
set(0,'showhidden','on')
errcode=30;
h=findobj('Tag','crqa_Fig'); if ~isempty(h), set(0,'CurrentFigure',h(1)); end
tx={'RR';'DET';'L';'ENTR';'LAM';'TT';'T_1';'T_2';'Variance';'Covariance'};
index=[1,2,3,5,6,7,9,10,11,12,13];
tags={'crqa_axes_RR','crqa_axes_DET','crqa_axes_L','crqa_axes_ENTR','crqa_axes_LAM','crqa_axes_TT','crqa_axes_T1','crqa_axes_T2','crqa_axes_Var','crqa_axes_CoVar'};
h=findobj('Tag','crqa_axes_RR','Parent',gcf); h_axes.h(1)=h(1);
h=findobj('Tag','crqa_axes_DET','Parent',gcf); h_axes.h(2)=h(1);
h=findobj('Tag','crqa_axes_L','Parent',gcf); h_axes.h(3)=h(1);
h=findobj('Tag','crqa_axes_ENTR','Parent',gcf); h_axes.h(4)=h(1);
h=findobj('Tag','crqa_axes_LAM','Parent',gcf); h_axes.h(5)=h(1);
h=findobj('Tag','crqa_axes_TT','Parent',gcf); h_axes.h(6)=h(1);
h=findobj('Tag','crqa_axes_T1','Parent',gcf); h_axes.h(7)=h(1);
h=findobj('Tag','crqa_axes_T2','Parent',gcf); h_axes.h(8)=h(1);
h=findobj('Tag','crqa_axes_Var','Parent',gcf); h_axes.h(9)=h(1);
if ~all(x(:)==y(:)), h=findobj('Tag','crqa_axes_CoVar','Parent',gcf); h_axes.h(10)=h(1); end
for i=1:9,
set(gcf,'CurrentAxes',h_axes.h(i))
if size(Y,1)==1
cla
text(0.5,0.5,sprintf('%6.4f',Y(index(i))),'FontWeight','bold','HorizontalAlign','Center')
% if ~all(x(:)==y(:)) & i==9
% cla
% text(0.5,0.5,sprintf('%6.5f, %6.5f',Y(index(i)),Y(index(i+1))),'FontWeight','bold','HorizontalAlign','Center')
% set(gcf,'CurrentAxes',h_axes.h(i+1));cla
% set(h_axes.h(i+1),'visible','off');
% end
else
if i==9
cla
h2=stairs(xscale(1:wstep:length(Y)),Y(1:wstep:end,index(i)));
set(h2,'color',props.line.Color)
if ~all(x(:)==y(:))
set(gca,'Color','none')
hold on; h2=stairs(xscale(1:wstep:length(Y)),Y(1:wstep:end,index(10)),'r');
set(gcf,'CurrentAxes',h_axes.h(i+1));cla
set(h_axes.h(10),'visible','on');
h3=stairs(xscale(1:wstep:length(Y)),Y(1:wstep:end,index(11))); set(h3,'color',[0 .4 0]);
ylabel(tx(i+1));
set(h_axes.h(i+1),'Tag',tags{i+1},'Units','Norm','Color','none','YAxisLocation','right','YColor',[0 .4 0])
end
else
plot(xscale(1:wstep:length(Y)),Y(1:wstep:end,index(i)),'color',props.line.Color)
end
end
set(gcf,'CurrentAxes',h_axes.h(i));
ylabel(tx(i));
set(gca,'Tag',tags{i},'color',props.axes.Color,'Units','Norm',...
'xlim',[xscale(1) xscale(end)])
end
h=findobj('Tag','crqa_button_store');
set(h(1),'UserData',Y,'Enable','On')
xlim = get(h_axes.h(9),'xlim');
if length(Y(:,1)) > 1, set(h_crqa_axes_Data,'xlim',xlim), end
if ~all(x(:)==y(:)) & length(Y(:,1)) == 1, set(h_axes.h(10),'visible','off'); delete(get(h_axes.h(10),'children')), end
else
if nargout, xout=Y(:,1:10); end
end
if nargout, xout=Y(:,1:10); end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% the end
end
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
if nogui~=2, if ishandle(hw), close(hw), end , end
z=whos;x=lasterr;y=lastwarn;in=varargin{1};
print_error('jrqa',z,x,y,in,method,action)
try, if ~nogui
h=findobj('tag','crqa_button_apply');
set(h(1),'ToolTip','Starts the computation.','String','Apply','Callback','jrqa compute')
for j=1:length(obj);
h=findobj('Tag',obj{j},'Parent',h_fig(1));
if ~isempty(h)
set(h,'Enable','On')
end
end, end
end
set(0,'showhidden','on')
h=findobj('Tag','crqa_Fig'); if ~isempty(h), setptr(h(1),'arrow'); end
set(0,'showhidden','off')
end
try, set(0,props.root), end
try
set(0,'ShowHidden','off')
end