📄 genfig_8.m
字号:
% GENFIG_8 Reproduces figure 8.
%
% USAGE
%
% GENFIG_8(color, display, filename)
%
% INPUTS
%
% color Color (true) or grayscale (false) (optional, default = true)
% display Displays (true) or does not display (false) the figure (optional, default = true)
% filename Saves the figure in eps format under the name 'filename' (optional, default = not saved)
%
% COPYRIGHT
%
% This file is part of the Matlab code provided for the following
% reproducible paper:
%
% Olivier Roy and Martin Vetterli,
% "Dimensionality Reduction for Distributed Estimation in the Infinite Dimensional Regime",
% vol. 54, no. 4, pp. 1655-1669, April 2008.
%
% This program is free software; you can redistribute it and/or modify it
% under the terms of the GNU General Public License as published by the
% Free Software Foundation; either version 2 of the License, or (at your
% option) any later version. This software is distributed in the hope that
% it will be useful, but without any warranty; without even the implied
% warranty of merchantability or fitness for a particular purpose.
% See the GNU General Public License for more details
% (enclosed in the file GPL).
%
% GNU General Public License,
% Copyright (C) 2008,
% Audiovisual Communications Laboratory (LCAV),
% Ecole Polytechnique F閐閞ale de Lausanne (EPFL),
% CH-1015 Lausanne.
%
% COMMENTS
%
% Author: Olivier Roy
% Latest modifications: April 2, 2008.
function genfig_8(color, display, filename)
% We set the default values for the input arguments
save = true;
if nargin < 3
save = false;
end
if nargin < 2
display = true;
end
if nargin < 1
color = true;
end
% We set the simulation parameters
randn('state',0); % for reproducible results
m = 30;
rho = 0.6;
% We define the covariance matrices of the involved vectors
R_S = toeplitz(rho.^[0:2*m-1]);
R_SX1 = R_S(:,1:2:2*m);
R_SX2 = R_S(:,2:2:2*m);
R_X1 = R_S(1:2:2*m,1:2:2*m);
R_X2 = R_S(2:2:2*m,2:2:2*m);
R_X1X2 = R_S(1:2:2*m,2:2:2*m);
R_SX = [R_SX1 R_SX2];
R_X = [R_X1 R_X1X2; R_X1X2' R_X2];
% We compute the infinite block-length distortion (IBLD) for different
% values of alpha1 and alpha2
alpha1_val = [0:m]/m;
alpha2_val = [0:m]/m;
dist_val = zeros(length(alpha1_val),length(alpha2_val));
for i=1:length(alpha1_val)
alpha1 = alpha1_val(i);
for j=1:length(alpha1_val)
alpha2 = alpha2_val(j);
dist_val(i,j) = algo1(R_S, R_X, R_SX, [m m], [floor(m*alpha1), floor(m*alpha2)], 'rand');
end
end
% We normalize the distortion
dist_val = dist_val/trace(R_S);
% We plot the figure
figure;
hold on
box on
surf(alpha2_val, alpha1_val, dist_val);
if (~color)
map = gray(256);
map = map(100:256,:);
colormap(map);
else
colormap('jet');
end
view(56,16);
a = axis;
axis([0, 1, 0, 1, 0, a(6)]);
box off
grid on
if save
xlabel('xLabel');
ylabel('yLabel');
zlabel('zLabel');
title('title');
saveas(gcf, filename,'psc2');
end
if display
xlabel('\alpha_1');
ylabel('\alpha_2');
zlabel('MSE');
else
close gcf
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -