⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 genfig_2a.m

📁 Dimensionality Reduction for Distributed Estimation in the Infinite Dimensional Regime
💻 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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -