?? genfig_2a.m
字號:
% GENFIG_2A Reproduces figure 2a.
%
% USAGE
%
% GENFIG_2A(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_2a(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
rho = 0.5;
sigma = sqrt(1);
% We define the covariance matrices of the involved vectors
R_S = [1 rho; rho 1];
R_SX1 = R_S;
R_SX2 = R_S;
R_SX = [R_SX1 R_SX2];
R_N = sigma^2*eye(2);
R_X1 = R_S + R_N;
R_X2 = R_S + R_N;
R_X1X2 = R_S;
R_X = [R_X1 R_X1X2; R_X1X2' R_X2];
% We compute the distortion for different values of theta and vartheta
theta_val = [0:0.1:2*pi];
vartheta_val = theta_val;
dist = [];
dist_row = [];
for (theta = theta_val)
for (vartheta = vartheta_val)
Q_1 = [cos(theta) sin(theta)];
Q_2 = [cos(vartheta) sin(vartheta)];
C = [Q_1 zeros(1,2);zeros(1,2) Q_2];
dist_row = [dist_row trace(R_S - R_SX*C'*inv(C*R_X*C')*C*R_SX')];
end
dist = [dist;dist_row];
dist_row = [];
end
% We plot the figure
figure;
surf(theta_val, vartheta_val, dist');
if (~color)
map = gray(256);
map = map(100:256,:);
colormap(map);
else
colormap('jet');
end
a = axis;
axis([0, theta_val(end), 0, vartheta_val(end), a(5), a(6)]);
box off
grid on
if save
xlabel('xLabel');
ylabel('yLabel');
title('title');
saveas(gcf, filename,'psc2');
end
if display
xlabel('\theta [rad]');
ylabel('\vartheta [rad]');
zlabel('MSE');
else
close gcf
end
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -