comparison m-toolbox/classes/+utils/@math/Rcovmat.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %
3 % Compute R matrix
4 %
5 % CALL
6 %
7 % Get R
8 % R = Rcovmat(x)
9 %
10 % INPUT
11 %
12 % - x data series
13
14 %
15 %
16 % L Ferraioli 10-10-2010
17 %
18 % $Id: Rcovmat.m,v 1.1 2010/11/16 16:41:37 luigi Exp $
19 %
20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
21
22 function R = Rcovmat(x)
23
24 % willing to work with rows
25 if size(x,1)>size(x,2)
26 x = x.';
27 end
28 % subtract the mean
29 x = x - mean(x);
30
31 nx = size(x,2);
32
33 x = fliplr(x);
34
35 % init trim matrix
36 R = zeros(nx,nx);
37 % fillin the trim matrix
38 for ii=1:nx
39 R(ii,ii:nx) = x(1:nx-ii+1);
40 end
41
42
43
44
45
46 end