09-10-2018 10:13 AM
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 ?
09-10-2018 10:34 AM
I don't know if it's just me but I'm not able to download your JPG file, it says network error.
09-10-2018 03:48 PM
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
forums.ni.com sent an invalid response.
09-11-2018 12:55 AM
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.
09-11-2018 04:43 PM
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
09-12-2018 06:48 AM
@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.
09-12-2018 02:47 PM
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
09-12-2018 03:45 PM
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