Home > chronux > spectral_analysis > pointbinned > mtfftpb.m

mtfftpb

PURPOSE

Multi-taper fourier transform - binned point process data

SYNOPSIS

function [J,Msp,Nsp]=mtfftpb(data,tapers,nfft)

DESCRIPTION

``` Multi-taper fourier transform - binned point process data

Usage:

[J,Msp,Nsp]=mtfftpb(data,tapers,nfft) - all arguments required
Input:
data   (in form samples x channels/trials or single vector)
tapers (precalculated tapers from dpss)
Output:
J (fft in form frequency index x taper index x channels/trials)
Msp (number of spikes per sample in each channel)
Nsp (number of spikes in each channel)```

CROSS-REFERENCE INFORMATION

This function calls:
This function is called by:
• CrossSpecMatpb
• coherencypb Multi-taper coherency,cross-spectrum and individual spectra - binned point process
• cohmatrixpb Multi-taper coherency matrix - binned point process
• mtdspectrumpb Multi-taper spectral derivative - binned point process
• mtspectrumpb Multi-taper spectrum - binned point process
• mtspectrumsegpb Multi-taper segmented spectrum for a univariate binned point process

SOURCE CODE

```0001 function [J,Msp,Nsp]=mtfftpb(data,tapers,nfft)
0002 % Multi-taper fourier transform - binned point process data
0003 %
0004 % Usage:
0005 %
0006 % [J,Msp,Nsp]=mtfftpb(data,tapers,nfft) - all arguments required
0007 % Input:
0008 %       data   (in form samples x channels/trials or single vector)
0009 %       tapers (precalculated tapers from dpss)
0010 %       nfft   (length of padded data)
0011 % Output:
0012 %       J (fft in form frequency index x taper index x channels/trials)
0013 %       Msp (number of spikes per sample in each channel)
0014 %       Nsp (number of spikes in each channel)
0015
0016 if nargin < 3; error('Need all input arguments'); end;
0017 data=change_row_to_column(data); % changes data stored as a row vector to a column vector
0018 [N,C]=size(data); % size of data
0019 K=size(tapers,2); % size of tapers
0020 tapers=tapers(:,:,ones(1,C)); % add channel indices to tapers
0021 H=fft(tapers,nfft,1); % fourier transform of the tapers
0022 Nsp=sum(data,1); % number of spikes in each channel
0023 Msp=Nsp'./N; % mean rate for each channel
0024 meansp=Msp(:,ones(1,K),ones(1,size(H,1)));  % add taper and frequency indices to meansp
0025 meansp=permute(meansp,[3,2,1]); % permute to get meansp with the same dimensions as H
0026 data=data(:,:,ones(1,K));% add taper indices to the data
0027 data=permute(data,[1 3 2]); % permute data to be of the same dimensions as H
0028 data_proj=data.*tapers; % multiply data by the tapers
0029 J=fft(data_proj,nfft,1); % fft of projected data
0030 J=J-H.*meansp; % subtract the dc```

Generated on Fri 28-Sep-2012 12:34:30 by m2html © 2005