DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

FFT calculation...how it works (in DIAdem)?

Solved!
Go to solution

Hello,

 

I am a new diadem user, apologies for my in-experience.
My task is very simple, calculate the FFT of a waveform channel sampled at 200kHz (in this case is a 1 second lenght sequence). I see that DIAdem offers several ways to perform that operations, so I tried some of those. Starting with the following setup I used both the Amplitude Peak and the Amplitude RMS:

 

FFTIndexChn = 0
FFTWndFct = "Rectangle"
FFTWndPara = 0
FFTWndChn = 0
FFTWndCorrectTyp = "No"
FFTCalc = 0
FFTAmpl = 1
FFTPhase = 0
FFTCepstrum = 0
FFTAmplType = "Ampl.Peak" OR "Ampl.RMS"
FFTAverageType = "No"
FFTAmplExt = "No"
FFTAmplFirst = "Amplitude"
FFTIntervUser = "LengthStartOverl"
FFTIntervOverl = 0
FFTNoV = 0
FFTIntervPara(1) = 1
FFTIntervPara(2) = 200000
FFTIntervPara(3) = 1

 

Looking at the results, in both the cases (peak or rms) I see that the output channel values (amplitude spectrum) are very low respect to those I was expecting. In particular if one computes the power (employing the Parseval's theorem for discrete sequences) of the sequence in the frequency domain and the power of the sequence in the time domain, one has a great difference between the magnitude of values (that I notice is proportional but NOT equal to the number of samples involved in the FFT calculation). In theory they should be equal (for the above cited theorem).

 

So, my question is: how does Diadem calculate the FFT? (I read the help and it seems a classic DFT...)
And, why this great difference between the two power values in time domain and in frequency domain?

 

P.s. if I calculate for the same sequence the two power values with Matlab I find the same number.

 

Thank you very much to anyone wants to help me.

 

Ciao,

 

Federico

 

 

0 Kudos
Message 1 of 20
(8,970 Views)

Hello Federico,

 

The document in the following thread might get you a little closer to an answer:

 

http://forums.ni.com/t5/DIAdem/FFT-calculations-in-DIAdem/m-p/1071519/highlight/true#M11524

 

Best regards,

 

     Otmar

Otmar D. Foehner
0 Kudos
Message 2 of 20
(8,957 Views)

Hello Otmar,

 

Thank your for the quick reply. I will read the doc carefully.

 

Kind regards,

 

Federico

0 Kudos
Message 3 of 20
(8,947 Views)

Hi Otmar,

 

I read the doc, it is very interesting and exhaustive, but unfortunately doesn't respond to my question.
I have tried to compute the power in time domain and frequency domain (after FFT) with simple signals also (e.g. 1 cycle of cosine wave with unitary amplitude, sampled at 200kHz), but the problem still remains: there is a significative difference between the two values, with a magnitude order of the number of samples considered by the FFT.

 

To be more clear here below the sequence of operations.

 

time sequence --> x(i), for i = 1 to N

amplitude frequency sequence --> X(k), for k =1 to N/2 (i.e. just positive frequency indexes computed by FFT in DIAdem)

 

Following the Parseval's theorem for discrete sequences:

 

power in the time domain --> powerT = sum( abs(x(i)) ^2 ), for i =1 to N

power in the frequency domain -->powerF = sum(2 * abs(X(k)) ^2 ), for K =1 to N/2 (the "2*" is for considering the absence of negative frequency indexes)

 

Now it should be --> powerT = powerF

Instead it results --> powerT ~= powerF * nSamples

 

Why?

(I state that the same sequences of operation performed with other software allow to obtain the expected equality between the two power values.)

 

I hope someone can fix this question. Thank you again.

 

Best regards,

 

Federico

0 Kudos
Message 4 of 20
(8,930 Views)

Hello Frederico,

 

it is difficult to say what went wrong with your comparisson. We have done a large number of comparissons like this and all kinds of software is producing almost identical results. The FFT is a very precise defined calculation. Unfortunately the naming and the usage of parameters is not very precise defined. It is sometimes difficult to find out what exactly is done in the different softwares. This was one of the reasons to create the doc, you got from Otmar.

 

I'm sure, I can show how to do this calculation with your data. Here is what has to be done:

 

The over all RMS in time domain is calculated by taking the Root of the Mean of the Squared values.

 

DIAdem has this function as one of the results in the "Descriptive Statistics".

 

In frequency domain, you have to calculate the FFT-result "Power spectrum" (which is the square of the RMS spectrum). The Root of the summation of the values in the Power spectrum should be the same as the over all RMS in time domain. Again, you can calculate the summation of a channel in the Descriptive statistics. It is also possible to start with the RMS spectrum and calculate the summation of the squares of a channel in the Descriptive statistics.

 

Best rergards

Ulrich

 

 

 

 

0 Kudos
Message 5 of 20
(8,894 Views)

Dear Ulrich,

 

Thank you for your response.

 

I appreciate your solution, but unfortunately I don't want to use the pre-defined DIAdem functions for calculating the signal power spectrum and its overall power, instead I want to use a theoretical approach (called "Welch's procedure", http://en.wikipedia.org/wiki/Welch's_method) that allows to obtain a power spectrum after the segmentation of a signal in the time domain (and other bring operations... 😉 ).


I am sure that employing that algorithm in DIAdem one obtains the right result (in terms of spectrum shape), however if I calculate with the Parseval Theorem (http://en.wikipedia.org/wiki/Parseval%27s_theorem) the power of the signal in the frequency domain I don't obtain the same value as the power in the time domain (whatever is the signal).

 

This difference can be easily verified by executing the code attached for a simple sinusoid signal.

 

So, the question is still open 😞 ...

 

Regards,

 

Federico

0 Kudos
Message 6 of 20
(8,837 Views)

Hi Federico,

 

If you don't want to use the existing ANALYSIS functions in DIAdem, then you will need to program the function yourself or call the function outside DIAdem via ActiveX or COM object or through a LabVIEW VI, etc.  DIAdem does not contain tools to implement your own free-form FFT algorithm.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 7 of 20
(8,823 Views)

Dear Brad,

 

Many thanks for your suggestion. The point is that I want to use the FFT algorithm performed by DIAdem (as example I used the built-in DIAdem FFT of a sinusoidal signal in the code I have attached in the previous post) with the "Amplitude Peak" case, but I want to calculate the power of the signal (and the corresponding power spectrum) without use the "Power Spectrum" option in the DIAdem FFT function or the "Descriptive Statistics".
The Parseval Theorem (not my theorem) must be applied and verified in DIAdem as in other signal processing software. The fact that one can obtain a reasonable for the signal power value only using the ANALYSIS functions looks as something strange to me (and a little cloudy...).

 

Kind regards,

 

Federico

 

0 Kudos
Message 8 of 20
(8,806 Views)

Hi Federico,

 

As far as I can tell, your VBScript is doing what you want to do with Parseval's theorem.  Are you asking for a more efficient way of accomplishing the same scaling?  If so, I have a lot of suggestions.  If not, what are you asking for help on, exactly?

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 9 of 20
(8,789 Views)

Hi Brad,

 

Maybe you missed my first post in this discussion. To write the Parseval's theorem in DIAdem is not a problem, instead the problem is to verify its result. The two overall power values, calculated in time and in frequency, are very different in magnitude, as my script shows.

 

So, since we agree that the power calculation is right, why this happen? The only "black box" (in the meaning that is a DIAdem function for signal processing) inside the procedure is the FFT, this is the reason of my title: "FFT calculation...how it works (in DIAdem)?".

 

I am asking if someone can demonstrate why there is this difference between the two power values and how to compensate for it. I think is a major question for DIAdem developer community, and of course for anyone working with the ANALYIS tools.

 

Hope this can clarify.

 

Regards,

 

Federico

 

 

0 Kudos
Message 10 of 20
(8,752 Views)