LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

fft- tone measurements.vi-filter.vi problems

Dear All,
If anybody can check the attached vi and answer some questions I would be more than appreciated.
This vi works perfectly when I use sine wave.vi instead of using the data array.
 
I cannot figure out why the frequency of the raw data (calculated through 'tone measurements.vi')
does not match the frequency observed on FFT graphs for both the raw data and the filtered data.
Also what is going on with filtering limits is not clear to me.
If current settings are used data is not filtered and the frequency seems to be around 0.114
which does not match the FFT plot either. Also filtered data is completely different than the
original data. If the filtering limits are modified so does the frequency
observed.

Low cut-off:0.0001
High cut-off:500
Calculated Frequency:0.114 hz
FFT: 99 hz
 
Low cut-off:1
High cut-off:200
Calculated Frequency:94 hz
FFT: 99 hz

Low cut-off:10
High cut-off:200
Calculated Frequency:99 hz
FFT: 99 hz
 
Thank you.
 
ilter
0 Kudos
Message 1 of 6
(3,002 Views)
I think I see part of the problem. Your raw data has a mean value of about 29.7 (visually from the graph) and never crosses zero. The low frequency component is around 1/6 Hz (again visually). The filter with a low cutoff of 100 microhertz will have a transient lasting a few hours (on the order of 1/f_low). You can see a distinct downward trend in the filtered data. Subtracting the mean before filtering might help. Also, FFT-based frequency measurement systems like lots of cycles of input data. The underlying mathematical theory assumes the signal has infinite duration. Some may not work well with one and a fraction cycles as you have. I do not have the time to explore your VI further at the moment, but this may give you a starting place.

Lynn
0 Kudos
Message 2 of 6
(2,999 Views)

My data analysis knowledge is not very wide, but i tried your suggestion to substract the mean from the data. Problems still persist.

Any more suggestions will be appreciated.

ilter

 

0 Kudos
Message 3 of 6
(2,985 Views)
I found another issue. The frequency range of a FFT-based analysis depends upon the number of samples and the sample rate. If you look at your spectrum graphs, you see that the minumum frequency is 0.4999 Hz. To measure your 0.1+ Hz signals you will need lower sample rates. Changing the sample rate to 100 Hz, dt to 0.01 and the upper cutoff frequency to 50 Hz (to meet Nyquist) shows the low frequency peak.

It still does not do much for your raw data. I will look at that further. (Assuming your raw data was sampled at 1 kHz, I need to make some other changes.)

I have attached a modified version of your VI with the mean subtraction and some changes to allow easier modification of the simulation parameters. I was working in LV8 and have not tested the 7.1 version.

Lynn
0 Kudos
Message 4 of 6
(2,983 Views)
My sampling rate was 1 kHz. Labview 7.1 did not have any problems.
 
Thank you very much.
 
Regards.
 
ilter
0 Kudos
Message 5 of 6
(2,980 Views)
Here is a test routine using your Raw Data and the basic FFT function. The frequency resolution of the FFT (as specified in the detailed help file) is df = fs/N, where df is the frequency separation of each element in the FFT output array or the width of the frequency bins, fs is the sampling frequency, and N is the number of samples. The FFT routines use a more efficient algorithm if N = 2^k where k is an integer. This can become significant if you are doing lots of spectra inside a loop. For your orignal VI fs = 1000 and N = 10000, so df = 0.1 Hz. All the information about your 0.15 Hz signal gets lumped into the frist two bins and becomes impossible to extract. The zero padding extends the length of the signal sent to the FFT to increase the resolution. The Window (Blackman-Harris or Hanning) smooths the spectrum. The reasons are more complex than I wish to go into unless you need the information.

Lynn
0 Kudos
Message 6 of 6
(2,976 Views)