view m-toolbox/classes/+utils/@math/Rcovmat.m @ 19:69e3d49b4b0c database-connection-manager

Update ltpda_uo.fromRepository
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Compute R matrix
% 
% CALL 
% 
% Get R
% R = Rcovmat(x)
% 
% INPUT
% 
% - x data series

% 
%
% L Ferraioli 10-10-2010
%
% $Id: Rcovmat.m,v 1.1 2010/11/16 16:41:37 luigi Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function R = Rcovmat(x)

  % willing to work with rows
  if size(x,1)>size(x,2)
    x = x.';
  end
  % subtract the mean
  x = x - mean(x);
  
  nx = size(x,2);
  
  x = fliplr(x);
    
  % init trim matrix
  R = zeros(nx,nx);
  % fillin the trim matrix
  for ii=1:nx
    R(ii,ii:nx) = x(1:nx-ii+1);
  end
  




end