comparison m-toolbox/classes/+utils/@math/freqCorr.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 % FREQCORR Compute correlation between frequency bins
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 % FREQCORR Compute correlation between frequency bins of a spectral
4 % estimation given the data window
5 %
6 % CALL
7 %
8 % Gf = utils.math.freqCorr(w,eta,T)
9 %
10 % INPUT
11 %
12 % - w, window samples, Nx1 double, N must be the effective length of the
13 % segments used for spectral estimation. E.g. For a periodogram N is equal
14 % to the length of the data series. For a WOSA estimation N is the length
15 % of each averaging segment.
16 % - eta, frequency lag in Hz, 1x1 double
17 % - T, sampling time in seconds, 1x1 double
18 %
19 % REFERENCES
20 %
21 % D. B. Percival and A. T. Walden, Spectral Analysis for Physical
22 % Applications (Cambridge University Press, Cambridge, 1993) p 231.
23 %
24 % L Ferraioli 09-03-2011
25 %
26 % $Id: freqCorr.m,v 1.1 2011/03/28 16:37:23 luigi Exp $
27 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
28 function R = freqCorr(w,eta,T)
29
30 Ns = numel(w);
31 % willing to work with columns
32 [nn,mm] = size(w);
33 if nn<mm
34 w = w.';
35 end
36 % make suqre integrable
37 a = sqrt(sum(w.^2));
38 w = w./a;
39
40 t = 1:Ns;
41
42 ww = w.*w;
43 hh = exp(-1i.*2.*pi.*t.*T.*eta)*ww;
44 R = abs(hh)^2;
45
46
47 end