📄 agod.m
字号:
function agod(filename,contrast);
% The function:
%
% agod(filename,contrast);
%
% displays the "Graph of Distances" (GoD)
% created with NLPm.exe and stored in the files:
% filename.sst
% filename.sgd
% filename.est
% filename.egd
% filename.cst
% filename.cgd
%
% The optional arg <contrast> is used to tune
% the contrast of the GoD. Default value is 2.0.
if nargin<2,
contrast = 2.0;
end;
% figure
figure;
% coord max
xmax = 0;
ymax = 0;
emax = 0;
% SST lecture fichier filename.sst
[sst,rsst,csst] = ld(strcat(filename,'.sst'));
if rsst*csst==0, oksst=0; else, oksst=1; end;
if oksst==1,
% SGD lecture fichier filename.sgd
[sgd,rsgd,csgd] = ld(strcat(filename,'.sgd'));
if rsgd*csgd==0, oksgd=0; else, oksgd=1; end;
% coord max
if oksgd==1,
xmax = max(xmax,sst(max(sgd(:,1))));
ymax = max(ymax,sst(max(sgd(:,2))));
end;
emax = max(emax,max(sst(:,2)));
end;
% EST lecture fichier filename.est
[est,rest,cest] = ld(strcat(filename,'.est'));
if rest*cest==0, okest=0; else, okest=1; end;
if okest==1,
% EGD lecture fichier filename.sgd
[egd,regd,cegd] = ld(strcat(filename,'.egd'));
if regd*cegd==0, okegd=0; else, okegd=1; end;
% coord max
if okegd==1,
xmax = max(xmax,est(max(egd(:,1))));
ymax = max(ymax,est(max(egd(:,2))));
end;
emax = max(emax,max(est(:,2)));
end;
% CST lecture fichier filename.cst
[cst,rcst,ccst] = ld(strcat(filename,'.cst'));
if rcst*ccst==0, okcst=0; else, okcst=1; end;
if okcst==1,
% cgd lecture fichier filename.sgd
[cgd,rcgd,ccgd] = ld(strcat(filename,'.cgd'));
if rcgd*ccgd==0, okcgd=0; else, okcgd=1; end;
% coord max
if okcgd==1,
xmax = max(xmax,cst(max(cgd(:,1))));
ymax = max(ymax,cst(max(cgd(:,2))));
end;
emax = max(emax,max(cst(:,2)));
end;
% nombre de colonnes ( = nbr de fichiers trouves)
ncols = oksst + okest + okcst;
if oksst==1 & oksgd==1,
% SGD sous figure
subplot(3,ncols,oksst);
colormap('gray');
% SGD polygone d'arriere plan
patch([0 0 xmax xmax],[0 ymax ymax 0],+contrast);
axis([0 xmax 0 ymax]);
% SGD pas
step = sst(2,1) - sst(1,1);
% SGD lecture du god
for cnt = 1:rsgd,
% polygone
patch(sst(1+sgd(cnt,1))+[0 0 step step],sst(1+sgd(cnt,2))+[0 step step 0],-sgd(cnt,3));
end;
shading flat;
% ligne diagonale
line([0 min(xmax,ymax)],[0 min(xmax,ymax)]);
% SGD ornements
title('Self-GOD');
xlabel('dY');
ylabel('dX');
% SST sous-figure
subplot(3,ncols,oksst+ncols);
% SST affichage
plot(sst(:,1),sst(:,2));
axis([0 xmax 0 emax]);
% SST ornements
title('Mean Quad. Error');
xlabel('dY');
ylabel('MQE');
% SST sous-figure
subplot(3,ncols,oksst+2*ncols);
% SST affichage
plot(sst(:,1),sst(:,3:4));
axis([0 xmax 0 1.5]);
% SST ornements
title('Linerty & Cumul. Density');
xlabel('dY');
ylabel('L&cD');
end;
if okest==1 & okegd==1,
% EGD sous figure
subplot(3,ncols,oksst+okest);
colormap('gray');
% EGD polygone d'arriere plan
patch([0 0 xmax xmax],[0 ymax ymax 0],+contrast);
axis([0 xmax 0 ymax]);
% EGD pas
step = est(2,1) - est(1,1);
% EGD lecture du god
for cnt = 1:regd,
% polygone
patch(est(1+egd(cnt,1))+[0 0 step step],est(1+egd(cnt,2))+[0 step step 0],-egd(cnt,3));
end;
shading flat;
% ligne diagonale
line([0 min(xmax,ymax)],[0 min(xmax,ymax)]);
% EGD ornements
title('Eucl. GOD');
xlabel('dY');
ylabel('dX');
% EST sous-figure
subplot(3,ncols,oksst+okcst+ncols);
% EST affichage
plot(est(:,1),est(:,2));
axis([0 xmax 0 emax]);
% EST ornements
title('Mean Quad. Error');
xlabel('dY');
ylabel('MQE');
% EST sous-figure
subplot(3,ncols,oksst+okest+2*ncols);
% EST affichage
plot(est(:,1),est(:,3:4));
axis([0 xmax 0 1.5]);
% EST ornements
title('Linerty & Cumul. Density');
xlabel('dY');
ylabel('L&cD');
end;
if okcst==1 & okcgd==1,
% cgd sous figure
subplot(3,ncols,oksst+okest+okcst);
colormap('gray');
% cgd polygone d'arriere plan
patch([0 0 xmax xmax],[0 ymax ymax 0],+contrast);
axis([0 xmax 0 ymax]);
% cgd pas
step = cst(2,1) - cst(1,1);
% cgd lecture du god
for cnt = 1:rcgd,
% polygone
patch(cst(1+cgd(cnt,1))+[0 0 step step],cst(1+cgd(cnt,2))+[0 step step 0],-cgd(cnt,3));
end;
shading flat;
% ligne diagonale
line([0 min(xmax,ymax)],[0 min(xmax,ymax)]);
% cgd ornements
title('Curv. GOD');
xlabel('dY');
ylabel('dX');
% cst sous-figure
subplot(3,ncols,oksst+okest+okcst+ncols);
% cst affichage
plot(cst(:,1),cst(:,2));
axis([0 xmax 0 emax]);
% cst ornements
title('Mean Quad. Error');
xlabel('dY');
ylabel('MQE');
% cst sous-figure
subplot(3,ncols,oksst+okest+okcst+2*ncols);
% cst affichage
plot(cst(:,1),cst(:,3:4));
axis([0 xmax 0 1.5]);
% ornements
title('Linerty & Cumul. Density');
xlabel('dY');
ylabel('L&cD');
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -