view m-toolbox/classes/+utils/@math/Rcovmat.m @ 51:9d5c88356247 database-connection-manager

Make unit tests database connection parameters configurable
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 07 Dec 2011 17:24:37 +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