# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## Power Spectrum output in frequencies

Hi

I have a quite simple question. I´m using the FFT Power Spectrum and PSD vi. and have a hard time understanding the output frequencies. As I understand it the first row is DC-value and the delta frequency then describe the following frequencies. But when I for example put in 8 points say 4Hz sampling frequency = 2sec of data to analyze, I get back 4 rows of data (incl. 0). If the first is DC, then the 2nd must be 1/2Hz the 3rd row = 1Hz and the 4th row = 3/2Hz, but what about the 2Hz Nyquist frequency, why don´t I get that one? or is there something that I misunderstand?

I also tried the FFT and Power spectrum Units.vi example to understand it but I still don´t get it.

Best

Jesper

Message 1 of 10
(3,051 Views)

## Re: Power Spectrum output in frequencies

You shouldn't get the Nyquist.  To be technical, the Nyquist frequency would alias down to DC.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 10
(3,047 Views)
Solution
Accepted by topic author jesboy

## Re: Power Spectrum output in frequencies

FFT's return the power in frequency bins. The frequency of the bins is determined by Fs (sampling frequency) divided by N (number of points), starting at DC (0Hz). For your case the array returned would be:

Bin 0: 0 - 0.5Hz

Bin 1: 0.5 - 1Hz

Bin 2: 1 - 1.5Hz

Bin 3: 1.5 - 2Hz

So effectively Bin 3 holds the average of the power from 1.5 - 2Hz (which contains your Nyquist frequency).

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
Message 3 of 10
(3,044 Views)

## Re: Power Spectrum output in frequencies

Thanks a lot Charles!! It all makes sense now.. Guess it´s been too long since I went to school;-)

Message 4 of 10
(3,042 Views)

## Re: Power Spectrum output in frequencies

I just have one extra question that you might be able to help me with Charles:

If I would like to compute the total power over a range of frequences say from 0,5Hz to 2Hz in the exsample about, should I then: A) add the bins of row 2,3,4 or B) take the integral from row 2-4?

And does it make a differens if i use Power Spectrum or Power Spectral Density?

Hope you can help one again:-)

Jesper

Message 5 of 10
(3,033 Views)

## Re: Power Spectrum output in frequencies

I believe that depends on if you requested linear or log y axis. If it is linear then yes, simply adding the bins together should work. I'd have to dig into the specific function that you are using to know if log scale is even viable to be summed. I sort of remember an FFT function that outputs a log with the main detected signal always at 0dB. That is great for THD and SINAD analysis but because it has all been randomly shifted to 0dB you can no longer calculate the absolute power. If this doesn't answer your question then please post the code and I'll take a look at it.

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
Message 6 of 10
(3,027 Views)

## Re: Power Spectrum output in frequencies

@jesboy wrote:

Thanks a lot Charles!! It all makes sense now.. Guess it´s been too long since I went to school;-)

FYI, crossrulz is correct, if your signal is EXACTLY on the Nyquist frequency, then it will be aliased to the DC bin, combining its power with the DC signal. Just wanted to make sure you realized that. Never use an FFT where a swept spectrum analyzer will do! 🙂

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
Message 7 of 10
(3,024 Views)

## Re: Power Spectrum output in frequencies

@Charles_CLA wrote:

to know if log scale is even viable to be summed.

@I believe you want to use the Euclidean Norm function on the array of bins if it is in log format. This is going to be relative to the other powers and not absolute. (this is true of anything that is pure dB). Euclidean Norm can be found @ vi.lib\measure\matone.llb\Euclidean Norm.vi

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
Message 8 of 10
(3,019 Views)

## Re: Power Spectrum output in frequencies

Thanks alot:-) It´s linear so no need for dB. I´m using it for Heart Rate Variability Analyses (don´t know if you´ve heard of it.), but I´m accually also trying to figure out the output of the Continues Wavelet Transformation, which I have a hard time understanding. I kind of understand the basic but again the output seems a bit strange to me. You seem to have great knowledge in the area, do you know about the Wavelet Transformation too?

And thanks again.

Best

Jesper

Message 9 of 10
(3,016 Views)

## Re: Power Spectrum output in frequencies

I've not dealt with either the Heart Rate Variability Analyses nor the Wavelet Transformation. I spent three and a half years characterizing the dynamic (AC) characteristics of ADC's, which is nearly all FFT analysis.

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
Message 10 of 10
(3,013 Views)