Goertz

Computes the discrete Fourier transform for a given frequency for a single signal.

Syntax

IppStatus ippsGoertz_32f(const Ipp32f* pSrc, int len, Ipp32fc* pVal, Ipp32f rFreq);

IppStatus ippsGoertz_64f(const Ipp64f* pSrc, int len, Ipp64fc* pVal, Ipp64f rFreq);

IppStatus ippsGoertz_32fc(const Ipp32fc* pSrc, int len, Ipp32fc* pVal, Ipp32f rFreq);

IppStatus ippsGoertz_64fc(const Ipp64fc* pSrc, int len, Ipp64fc* pVal, Ipp64f rFreq);

IppStatus ippsGoertz_16s_Sfs(const Ipp16s* pSrc, int len, Ipp16sc* pVal, Ipp32f rFreq, int scaleFactor);

IppStatus ippsGoertz_16sc_Sfs(const Ipp16sc* pSrc, int len, Ipp16sc* pVal, Ipp32f rFreq, int scaleFactor);

IppStatus ippsGoertzQ15_16sc_Sfs(const Ipp16sc* pSrc, int len, Ipp16sc* pVal, Ipp16s rFreqQ15, int scaleFactor);

Parameters

pSrc

Pointer to the input data vector.

len

Number of elements in the vector.

pVal

Pointer to the output DFT value.

rFreq

Single relative frequency value [0, 1.0).

rFreqQ15

Single relative frequency value in Q15 format [0, 32767].

scaleFactor

Scale factor, refer to Integer Scaling.

Description

The function ippsGoertz is declared in the ipps.h file. This function computes a DFT for an input len-length vector pSrc for a given frequency rFreq, and stores the result in pVal.

ippsGoertzQ15. This function operates with relative frequency in Q15 format. Data in Q15 format are converted to the corresponding float data type that lay in the range [0, 1.0).

The functionality of the Goertzel algorithm can be described as follows:



where k/N is the normalized rFreq value for which the DFT is computed.

Example below illustrates the use of Goertzel functions for selecting the magnitudes of a given frequency when computing DFTs.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error when one of the specified pointers is NULL.

ippStsRelFreqErr

Indicates an error when rFreq is out of range.

ippStsSizeErr

Indicates an error when len is less than or equal to 0.

Using Goertzel Functions for Selecting Magnitudes of a Given Frequency

IppStatus
goertzel( void ) {
#undef  LEN
#define LEN 100
     IppStatus status;
     Ipp32fc *x = ippsMalloc_32fc( LEN ), y;
     int n;
     ///generate a signal of 60 Hz freq that
     /// is sampled with 400 Hz freq
     for( n=0; n<LEN; ++n) {
        x[n].re =(Ipp32f)sin(IPP_2PI * n * 60 / 400);
        x[n].im = 0;
     }
     status = ippsGoertz_32fc( x, LEN, &y, 60.0f / 400 );
     printf_32fc("goertz =", &y, 1, status );
     ippsFree( x );
     return status;
}
Output:
    goertz =  {0.000090,-50.000008}
Matlab* Analog
    >> N=100;F=60/400;n=0:N-1;x=sin(2*pi*n*F);y=fft(x);n=N*F;y(n+1)




Submit feedback on this help topic

Copyright © 2000 - 2011, Intel Corporation. All rights reserved.