fft_norm_amp

 

Description

Performs amplitude normalization.

Syntax

int fft_norm_amp( vector<complex> & vSignal )

Parameters

vSignal
[modify] the data for input and the result of vSignal after normalize amplitude for output

Return

Returns OE_NOERROR for success or error codes for failure.

Examples

Prior to compilation, load fft_utils.c to the workspace by executing the following LabTalk command:

Run.LoadOC("Originlab\fft_utils.c", 16);

To retain fft_utils.c in the workspace for successive sessions, drag and drop the file from the Temporary folder to the System folder.

EX1

 
#include <fft_utils.h> 
void fft_norm_amp_ex1()
{
        vector<complex> vSignal = {36, -4 + 9.6569i, -4 + 4i, -4 + 1.6569i,
            -4,    -4 - 1.6569i, -4 - 4i, -4 - 9.6569i};
            
        //the result should be 
        //{9.0000, -1 + 2.4142i, -1 + 1i, -1 + 0.4142i, -1, -1 + -0.4142,
        // -1 - 1i, 1 -2.4142}
        int nRet = fft_norm_amp(vSignal);    
        if( 0 != nRet )
        {
            printf("fft_norm_amp function returned error: %d\n", nRet);
            return;
        }
}

Remark

This function perform amplitude normalization.

The effect on the FFT result is to divide the amplitudes of the DC and AC components by N/2, where N is the number of data points. This will reveal the true amplitudes in the original data set.

This occurs because we know that cos(x) = [exp(-ix) + exp(ix)]/2.

Thus, when a time domain data set is transformed into the frequency domain by FFT, each component splits into two frequencies, a positive one and its negative image.

The amplitude of each of these frequencies is N/2 times that of its original component.

To calculate the mean of the data set, divide the DC component by 2.

See Also

header to Include

fft_utils.h

Reference