Home > matlabmk > mtfftc.m

mtfftc

PURPOSE

Multi-taper fourier transform - continuous data

SYNOPSIS

function J=mtfftc(data,tapers,nfft,Fs)

DESCRIPTION

``` Multi-taper fourier transform - continuous data

Usage:
J=mtfftc(data,tapers,nfft,Fs) - all arguments required
Input:
data (in form samples x channels/trials or a single vector)
tapers (precalculated tapers from dpss)
Fs   (sampling frequency)

Output:
J (fft in form frequency index x taper index x channels/trials)```

CROSS-REFERENCE INFORMATION

This function calls:
This function is called by:

SOURCE CODE

```0001 function J=mtfftc(data,tapers,nfft,Fs)
0002 % Multi-taper fourier transform - continuous data
0003 %
0004 % Usage:
0005 % J=mtfftc(data,tapers,nfft,Fs) - all arguments required
0006 % Input:
0007 %       data (in form samples x channels/trials or a single vector)
0008 %       tapers (precalculated tapers from dpss)
0009 %       nfft (length of padded data)
0010 %       Fs   (sampling frequency)
0011 %
0012 % Output:
0013 %       J (fft in form frequency index x taper index x channels/trials)
0014 if nargin < 4; error('Need all input arguments'); end;
0015 data=change_row_to_column(data);
0016 [NC,C]=size(data); % size of data
0017 [NK K]=size(tapers); % size of tapers
0018 if NK~=NC; error('length of tapers is incompatible with length of data'); end;
0019 tapers=tapers(:,:,ones(1,C)); % add channel indices to tapers
0020 data=data(:,:,ones(1,K)); % add taper indices to data
0021 data=permute(data,[1 3 2]); % reshape data to get dimensions to match those of tapers
0022 data_proj=data.*tapers; % product of data with tapers
0023 J=fft(data_proj,nfft)/Fs;   % fft of projected data```

Generated on Tue 10-May-2016 16:37:45 by m2html © 2005