Home > chronux > spectral_analysis > continuous > quadinv.m

## DESCRIPTION ``` calculates the quadratic inverse eigenvectors

Input
N: number of samples
NW: time-bandwidth product

Output

## CROSS-REFERENCE INFORMATION This function calls:
This function is called by:

## SOURCE CODE ```0001 function [V,E] = quadinv(N,NW)
0002
0003 % calculates the quadratic inverse eigenvectors
0004 %
0005 % Input
0006 % N: number of samples
0007 % NW: time-bandwidth product
0008 %
0009 % Output
0010 % V: The quadratic inverse eigenvectors
0011 % E: the quadratic inverse eigenvalues
0012
0013
0014 x = 0:N-1;
0015 indx = find(x);
0016 y = ones(size(x))*(2*NW/N)^2;
0017
0018 y(indx) = (sin(2*pi*NW*x(indx)/N)./(pi*x(indx))).^2;
0019
0020 M = toeplitz(y);
0021 [C,D] = eig(N*M);
0022
0023 tmp = diag(D);
0024
0025 K = 4*NW;
0026
0027 V = sqrt(N)*C(:,N:-1:N-K+1);
0028
0029 E = tmp(N:-1:N-K+1);
0030
0031 for ii =1:K
0032   if(sum((N-1-2*x)'.*V(:,ii))<0)
0033     V(:,ii) = flipud(V(:,ii));
0034   end;
0035 end;
0036
0037 return;```

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