Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Using ScaledWindow and RealFft and PowerSpectrum

Is this the correct solution for taking a time wave form (in acceleration (g)) and then converting it into a frequency domain...

double[] myData = GetTimeWaveFormData();
double myNoise = 0;
double myGain = 0;

ScaledWindow myWindow = new ScaledWindow(ScaledWindowType.Hanning);
myWindow.Apply(myData,out myNoise,out myGain);

NationalInstruments.ComplexDouble[] myFFT;
myFFT = Transforms.RealFft(myData);

int myFFTSize = myData.Length / 2;

for (int i = 0;i < myFFTSize;i++)
{
Data[i] = myFFT[i].Magnitude / myFFTSize;
}

Do I need to divide the values in resulting data by myGain?

What can I do with the myNoise value?

I have also noticed the PowerSpectrum() function, when would you use that function?
0 Kudos
Message 1 of 2
(3,786 Views)
Hello

You can use the Transforms.AmplitudePhaseSpectrum method and this will automatically provide you with a scaled single sided frequency domain data of the time domain signal. This way, you wont have to worry a about the manipulating the fft data to not include the negative frequencies. You can use the PowerSpectrum function as well, but you loose phase information with the PowerSpectrum algorith. You can check out the individual functions for more details on how to use them and also refer to this application note for more information about the algorithms and the results they provide. You can still apply the windows, since that reduces spectral leakage. You can experiment with the different kinds of windowing functions available to see which gives you the best output.

I hope this helps.
Bilal Durrani
NI
0 Kudos
Message 2 of 2
(3,766 Views)