From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Finding a energy from FFT Labview

Hello everyone,

I have problem with frequency resolution in fft (i can not change number sample and sample rate because acquisition become slow ). 

I have 2Vpp sine signal with Frequency  105.10Hz in time domain and in frequency domain i have fft as shown in fig. 

anyone has a idea how can i calculate energy of signal ?

Root square error or Average ?

Kuddo welcomed
CLAD-CTD
0 Kudos
Message 1 of 8
(2,571 Views)

I don't know if it's just me but I'm not able to download your JPG file, it says network error.

0 Kudos
Message 2 of 8
(2,559 Views)

Would it be fair to say you might not understand FFTs and digital signal analysis?  As it happens, when I try to open your figure of "something" (I can't tell if it's of an FFT or of your code, you'll see why), my browser says 

This page isnt working

forums.ni.com sent an invalid response.

ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION
 
I think we really need to see the code -- please attach the VI that you are trying to use.  I am mystified by "i can not change number sample and sample rate because acquisition become slow".  You are look at a signal that's supposed to be at 105.10 Hz, but you say nothing about (a) how fast you are sampling this signal, (b) for how long you need to sample it, and (c) what sort of frequency resolution you hope to obtain (these parameters are related, I hope you know).
 
Bob Schor
 
 
0 Kudos
Message 3 of 8
(2,530 Views)

Please Find attached VI. Currently it has  only Sine wave generation and FFT Magnitude and Phase VI. Here all my parameter value like  frequency or  amplitude are simulation data. Sampling rate 100k and Sample to read 10k.

Once i am able to find energy in this distributed frequency band then i can integrate into my application (Frequency range 5-30 kHz) where Sine wave is a signal from my acceleration sensor.

 

Kuddo welcomed
CLAD-CTD
Download All
0 Kudos
Message 4 of 8
(2,511 Views)

You put the answer to your dilemma right on the Front Panel of your VI -- "Freq Resolution = 10 Hz".  The FFT estimates the component of the signal in 10 Hz bins, so you have some "signal" at 80 Hz, some at 90 Hz, some at 100 Hz, some at 110 Hz, some at 120 Hz.  The biggest peak will be at 110, which is closest to 105.1 Hz, but it's a "crude" estimate, so you can't expect it to be precise.

 

Suppose you sample 20,000 points at 1 kHz, for a resolution of 0.05 Hz.  Your FFT would be a single "sharp" peak, with magnitude of 0.7071 (which you might realize is sqrt(2)/2, the correct answer).

 

Nothing wrong with your code, you just don't know how/when to use an FFT.

 

Bob Schor

0 Kudos
Message 5 of 8
(2,475 Views)

@Bob_Schor The biggest peak will be at 110, which is closest to 105.1 Hz, but it's a "crude" estimate, so you can't expect it to be precise. 

I know that with this resolution i can not expect precise and Sharp peak  but in this scenario(with this sample rate and Number of sample) if i want to find Energy that distributed to near frequency(I have some "signal" at 80 Hz, some at 90 Hz, some at 100 Hz, some at 110 Hz, some at 120 Hz) which estimation is good whether taking Quadratic mean or just average that can give me magnitude near to 0,7071. That is the problem i am facing.

 


@Bob_Schor wrote:

Suppose you sample 20,000 points at 1 kHz, for a resolution of 0.05 Hz.  Your FFT would be a single "sharp" peak, with magnitude of 0.7071 (which you might realize is sqrt(2)/2, the correct answer)

 


In this case my acquisition become slow and i read data or update graph  after every 20 Sec (Because 1k sample rate and 20k Sample to read). I am doing computation on fly so i want acquisition to be fast and once measurement taken, I shift to next frequency.

Kuddo welcomed
CLAD-CTD
0 Kudos
Message 6 of 8
(2,462 Views)

The frequency resolution you get with an FFT is the same as the lowest frequency you can (meaningfully) measure, which is when the period of the FFT = period of the lowest frequency.  So if you want a frequency resolution of 0.1Hz, you must record for 10 seconds.

 

Determine the frequency resolution that you need, and use that to set the minimum sampling time.  The sampling frequency is related to the highest frequency you want to resolve -- you need to sample at least twice as fast.

 

Bob Schor

0 Kudos
Message 7 of 8
(2,454 Views)

Because you don't have frequency bins that match your resolution, you get "leakage" into the other frequency bins. A crude way of determining the RMS is adding the whole spectra, note this is exact when you frequency falls into a bin. If you can deal with some uncertainty try summing around the peak in question.

 

mcduff

snip1.png

 

 

 

0 Kudos
Message 8 of 8
(2,452 Views)