## Developer Reference

• 2021
• 03/26/2021
• Public Content
Contents

# Goertz

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

## Syntax

Include Files
ipps.h
Domain Dependencies
Headers:
ippcore.h
,
ippvm.h
Libraries:
ippcore.lib
,
ippvm.lib
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).
scaleFactor
Scale factor, refer to Integer Scaling.
Description
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.
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.

## Example

The example below illustrates the use of Goertzel functions for selecting the magnitudes of a given frequency when computing DFTs.
```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)```

#### Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.