view m-toolbox/classes/+utils/@math/dft.m @ 52:daf4eab1a51e
database-connection-manager tip
Fix. Default password should be [] not an empty string
author
Daniele Nicolodi <nicolodi@science.unitn.it>
date
Wed, 07 Dec 2011 17:29:47 +0100 (2011-12-07)
parents
f0afece42f48
children
line source
+ − % DFT Compute discrete fourier transform at a given frequency
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − % DFT Compute discrete fourier transform at a given frequency
+ − % It is defined as
+ − % X(f) = T*sum(x(t)*exp(-1i.*2.*pi.*f.*T.*t))|t=0,...,N-1
+ − % where T is the sampling time
+ − %
+ − % CALL
+ − %
+ − % Gf = utils.math.dft(gt,f,T)
+ − %
+ − % INPUT
+ − %
+ − % - gt, input data series, Nx1 double
+ − % - f, a frequency point in Hz, 1x1 double
+ − % - T, sampling time in seconds, 1x1 double
+ − %
+ − % REFERENCES
+ − %
+ − % D. B. Percival and A. T. Walden, Spectral Analysis for Physical
+ − % Applications (Cambridge University Press, Cambridge, 1993) p 108.
+ − %
+ − % L Ferraioli 09-03-2011
+ − %
+ − % $Id: dft.m,v 1.2 2011/03/29 15:36:43 luigi Exp $
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − function Gf = dft(gt,f,T)
+ −
+ − [nn,mm] = size(gt);
+ − if nn<mm % willing to work with columns
+ − gt = gt.';
+ − end
+ − N = numel(gt);
+ − t = 0:N-1;
+ −
+ − ar = exp(-1i.*2.*pi.*f.*T.*t);
+ −
+ − Gf = T*(ar*gt);
+ −
+ −
+ − end