<< Previous | Next >>

powerspectrum

void powerspectrum( int * x, int N, * int blockexp );

Description

Computes the power spectrum from a complex spectrum according to

   

Power[k] = (Re X[k])2 + (Im X[k])2 

The N-point power spectrum replaces the N-point complex spectrum. The power of each complex spectral component is computed as a 32-bit fraction. Its more significant 16-bits replace the imaginary part of the component; its less significant 16-bits replace the real part.

If the complex input spectrum is a positive-frequency spectrum computed by fftreal(), the imaginary part of the X[0] term (stored x[1]) will contain the real part of the fmax term and will affect the calculation of the dc power. If the dc power or the fmax power is important, the fmax term should be retrieved from x[1] and x[1] set to zero before calling powerspectrum().

The power of the kth term can be retrieved via

   

P[k]=*(long*)&x[2k]*2^blockexp.

The value of blockexp is first doubled to reflect the squaring operation applied to all elements in array x. Then it is further increased by 1 to reflect an inherent division by two that occurs during the squaring operation.

Parameters

x
Pointer to N-element array of complex fractions.

N
Number of complex elements in array x.

blockexp
Pointer to integer block exponent.

Library

FFT.LIB

See also

fftcplx, fftcplxinv, fftreal, fftrealinv, hanncplx, hannreal


Dynamic C Functions << Previous | Next >> rabbit.com