📄 figuremaker.m
字号:
close all;
figdir = 'Figures';
for mindists = 1:length(mindist)
meanplot_ppc = [];
meanplot_dapc = [];
stdplot_ppc = [];
stdplot_dapc = [];
spplot_ppc = [];
mpplot_ppc = [];
spplot_dapc = [];
mpplot_dapc = [];
for runs = 1:length(nn)
tempname = strcat(ppcname, '_MEAN_R', int2str(nn(runs)), '_D', num2str(mindist(mindists)))
tempname = strrep(tempname, '.', '_');
eval(['meanplot_ppc = [meanplot_ppc ' tempname ']']);
tempname = strcat(ppcname, '_STD_R', int2str(nn(runs)), '_D', num2str(mindist(mindists)))
tempname = strrep(tempname, '.', '_');
eval(['stdplot_ppc = [stdplot_ppc ' tempname ']']);
tempname = strcat(ppcname, '_STD_PERCENTAGE_R', int2str(nn(runs)), '_D', num2str(mindist(mindists)))
tempname = strrep(tempname, '.', '_');
eval(['spplot_ppc = [spplot_ppc ' tempname ']']);
tempname = strcat(ppcname, '_MEAN_PERCENTAGE_R', int2str(nn(runs)), '_D', num2str(mindist(mindists)))
tempname = strrep(tempname, '.', '_');
eval(['mpplot_ppc = [mpplot_ppc ' tempname ']']);
tempname = strcat(dapcname, '_MEAN_R', int2str(nn(runs)), '_D', num2str(mindist(mindists)))
tempname = strrep(tempname, '.', '_');
eval(['meanplot_dapc = [meanplot_dapc ' tempname ']']);
tempname = strcat(dapcname, '_STD_R', int2str(nn(runs)), '_D', num2str(mindist(mindists)))
tempname = strrep(tempname, '.', '_');
eval(['stdplot_dapc = [stdplot_dapc ' tempname ']']);
tempname = strcat(dapcname, '_STD_PERCENTAGE_R', int2str(nn(runs)), '_D', num2str(mindist(mindists)))
tempname = strrep(tempname, '.', '_');
eval(['spplot_dapc = [spplot_dapc ' tempname ']']);
tempname = strcat(dapcname, '_MEAN_PERCENTAGE_R', int2str(nn(runs)), '_D', num2str(mindist(mindists)))
tempname = strrep(tempname, '.', '_');
eval(['mpplot_dapc = [mpplot_dapc ' tempname ']']);
end
figure;
h = plot(nn, meanplot_ppc ,'r-.+', 'lineWidth', 1);
hold on;
h = plot(nn, meanplot_dapc ,'b-s', 'lineWidth', 2);
titlename = sprintf('Average detection range with a minimum distance of %s meters', num2str(mindist(mindists)));
title(titlename);
xlabel('number readers in the network');
ylabel('average detection range (meters)');
legend('PPC', 'DAPC',4);
axis([5 60 0 2]);
set(gca,'XTick',nn);
plotname = strcat(figdir, '/MEAN_RANGE_FIX_DENSITY_VAR_SIZE_', num2str(mindist(mindists)), '.emf');
eval(['print -dmeta ' plotname]);
%hgsave(1, plotname);
figure;
h = plot(nn, stdplot_ppc ,'r-.+', 'lineWidth', 1);
hold on;
h = plot(nn, stdplot_dapc ,'b-s','lineWidth', 2);
titlename = sprintf('Standard deviation of average detection range with a minimum distance of %s meters', num2str(mindist(mindists)));
title(titlename);
xlabel('number readers in the network');
ylabel('Standard deviation of average detection range');
legend('PPC', 'DAPC', 4);
set(gca,'XTick',nn);
plotname = strcat(figdir, '/STD_RANGE_FIX_DENSITY_VAR_SIZE_', num2str(mindist(mindists)), '.emf');
eval(['print -dmeta ' plotname]);
%hgsave(2, plotname);
figure;
h = plot(nn, mpplot_ppc ,'r-.+', 'lineWidth', 1);
hold on;
h = plot(nn, mpplot_dapc ,'b-s', 'lineWidth', 2);
titlename = sprintf('Average percentage of time achieving desired range with a minimum distance of %s meters', num2str(mindist(mindists)));
title(titlename);
xlabel('number readers in the network');
ylabel('percentage of time achieving desired range');
legend('PPC', 'DAPC',4);
axis([5 60 min(min(mpplot_ppc), min(mpplot_dapc)) max(max(mpplot_ppc), max(mpplot_dapc))]);
set(gca,'XTick', nn);
plotname = strcat(figdir, '/MEAN_PERC_FIX_DENSITY_VAR_SIZE_', num2str(mindist(mindists)), '.emf');
eval(['print -dmeta ' plotname]);
%hgsave(3, plotname);
figure;
h = plot(nn, spplot_ppc ,'r-.+', 'lineWidth', 1);
hold on;
h = plot(nn, spplot_dapc ,'b-s','lineWidth', 2);
titlename = sprintf('Standard deviation of percentage of time achieving desired range with a minimum distance of %s meters', num2str(mindist(mindists)));
title(titlename);
xlabel('number readers in the network');
ylabel('Standard deviation of percentage of time achieving desired range');
legend('PPC', 'DAPC', 4);
plotname = strcat(figdir, '/STD_PERC_FIX_DENSITY_VAR_SIZE_', num2str(mindist(mindists)), '.emf');
eval(['print -dmeta ' plotname]);
%hgsave(4, plotname);
close all;
end
for runs = 1:length(nn)
meanplot_ppc = [];
meanplot_dapc = [];
stdplot_ppc = [];
stdplot_dapc = [];
spplot_ppc = [];
mpplot_ppc = [];
spplot_dapc = [];
mpplot_dapc = [];
for mindists = 1:length(mindist)
tempname = strcat(ppcname, '_MEAN_R', num2str(nn(runs)), '_D', num2str(mindist(mindists)))
tempname = strrep(tempname, '.', '_');
eval(['meanplot_ppc = [meanplot_ppc ' tempname ']']);
tempname = strcat(ppcname, '_STD_R', num2str(nn(runs)), '_D', num2str(mindist(mindists)))
tempname = strrep(tempname, '.', '_');
eval(['stdplot_ppc = [stdplot_ppc ' tempname ']']);
tempname = strcat(ppcname, '_STD_PERCENTAGE_R', num2str(nn(runs)), '_D', num2str(mindist(mindists)))
tempname = strrep(tempname, '.', '_');
eval(['spplot_ppc = [spplot_ppc ' tempname ']']);
tempname = strcat(ppcname, '_MEAN_PERCENTAGE_R', num2str(nn(runs)), '_D', num2str(mindist(mindists)))
tempname = strrep(tempname, '.', '_');
eval(['mpplot_ppc = [mpplot_ppc ' tempname ']']);
tempname = strcat(dapcname, '_MEAN_R', num2str(nn(runs)), '_D', num2str(mindist(mindists)))
tempname = strrep(tempname, '.', '_');
eval(['meanplot_dapc = [meanplot_dapc ' tempname ']']);
tempname = strcat(dapcname, '_STD_R', num2str(nn(runs)), '_D', num2str(mindist(mindists)))
tempname = strrep(tempname, '.', '_');
eval(['stdplot_dapc = [stdplot_dapc ' tempname ']']);
tempname = strcat(dapcname, '_STD_PERCENTAGE_R', num2str(nn(runs)), '_D', num2str(mindist(mindists)))
tempname = strrep(tempname, '.', '_');
eval(['spplot_dapc = [spplot_dapc ' tempname ']']);
tempname = strcat(dapcname, '_MEAN_PERCENTAGE_R', num2str(nn(runs)), '_D', num2str(mindist(mindists)))
tempname = strrep(tempname, '.', '_');
eval(['mpplot_dapc = [mpplot_dapc ' tempname ']']);
end
figure;
h = plot(mindist, meanplot_ppc ,'r-.+', 'lineWidth', 1);
hold on;
h = plot(mindist, meanplot_dapc ,'b-s', 'lineWidth', 2);
titlename = sprintf('Average detection range with %s nodes', num2str(nn(runs)));
title(titlename);
xlabel('minimum distance between readers (meters)');
ylabel('average detection range (meters)');
legend('PPC', 'DAPC');
axis([3 14 0 2]);
set(gca,'XTick', mindist);
plotname = strcat(figdir, '/MEAN_RANGE_FIX_SIZE_VAR_DENSITY_', num2str(nn(runs)), '.emf');
eval(['print -dmeta ' plotname]);
figure;
h = plot(mindist, stdplot_ppc ,'r-.+', 'lineWidth', 1);
hold on;
h = plot(mindist, stdplot_dapc ,'b-s', 'lineWidth', 2);
titlename = sprintf('Standard deviation of average detection range with %s nodes', num2str(nn(runs)));
xlabel('minimum distance between readers (meters)');
ylabel('Standard deviation');
legend('PPC', 'DAPC');
set(gca,'XTick', mindist);
plotname = strcat(figdir, '/STD_PERC_FIX_SIZE_VAR_DENSITY_', num2str(nn(runs)), '.emf');
eval(['print -dmeta ' plotname]);
figure;
h = plot(mindist, mpplot_ppc ,'r-.+', 'lineWidth', 1);
hold on;
h = plot(mindist, mpplot_dapc ,'b-s', 'lineWidth', 2);
titlename = sprintf('Average percentage of time achieving desired range with %s nodes', num2str(nn(runs)));
title(titlename);
xlabel('minimum distance between readers (meters)');
ylabel('percentage of time achieving desired range');
legend('PPC', 'DAPC');
axis([3 14 min(min(mpplot_ppc), min(mpplot_dapc)) max(max(mpplot_ppc), max(mpplot_dapc))]);
set(gca,'XTick', mindist);
plotname = strcat(figdir, '/MEAN_PERC_FIX_SIZE_VAR_DENSITY_', num2str(nn(runs)), '.emf');
eval(['print -dmeta ' plotname]);
figure;
h = plot(mindist, spplot_ppc ,'r-.+', 'lineWidth', 1);
hold on;
h = plot(mindist, spplot_dapc ,'b-s', 'lineWidth', 2);
titlename = sprintf('Standard deviation of percentage of time achieving desired range with %s nodes', num2str(nn(runs)));
title(titlename);
xlabel('minimum distance between readers (meters)');
ylabel('Standard deviation');
legend('PPC', 'DAPC');
set(gca,'XTick', nn);
plotname = strcat(figdir, '/STD_PERC_FIX_SIZE_VAR_DENSITY_', num2str(nn(runs)), '.emf');
eval(['print -dmeta ' plotname]);
%
close all;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -