LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Determining dominant frequency of time domain signal ?

I have a time varying signal which appears to cycle every 20 samples. When i apply the Real FFT vi, it comes up with a peak at 10Hz (i would expect a peak at 0.05 Hz) and a peak at a much higher frequency. It almost looks like a mirror image of the peak at 10Hz, but at the other end of the spectrum. I think the Real FFT VI may not be what i am looking for. Does anyone know the most suitable VI for what i am trying to do ?
0 Kudos
Message 1 of 9
(7,695 Views)
You should not confuse the sample rate of your signal with the actual frequency resolution. If your sample rate is 1 sample/s your signal will be periodic with a frequency of 1/20 samples = 0.05 Hz. But your 10 Hz signal will repeat with 20 samples if your sample rate (or Scan Rate if your are using a DAQ board) is Fs = 20 * 10 = 200 Hz. Is it the case ?

The FFT is probably the fastest most accurate way of finding your dominant tone. Try for example the dedicated VI "Extract Single Tone Information.vi" located in your Analyze-->> Waveform Measurents palette.
0 Kudos
Message 2 of 9
(7,695 Views)
Alain,

Thanks for the swift answer. I am reading the data from a file i created during experiments. It was scanned at 25Hz. But as far as the LabVIEW program is concerned, it should see a 0.05HZ dominant tone, as i am only reading out the values in a while loop with no timing information. Does this sound right?

I'll look at the VI you suggested.

thanks,

Fraser
0 Kudos
Message 3 of 9
(7,695 Views)
I have attached a VI that shows what I think is your problem. If your file contains 200 samples and if you do not provide your FFT with the sample rate information, your tone will appear as the 10th "bin" in your spectrum. But the frequency resolution of 1 bin correspond really to 1/200 Hz so your signal does appear as a 10/200 = 0.05 Hz. The VI shows what happens if you use a high level Power FFT VI with true sample rate information (25 Hz in your case). Your signal now appears as 1.25 Hz and that is exactly what 20 samples at a rate of 25 sample/s is.
Message 4 of 9
(7,695 Views)
Alain,

Thanks for the effort. That seems to have been the problem.

Fraser
0 Kudos
Message 5 of 9
(7,695 Views)
Alain,

I have been trying to find a way to bandpass filter my signal and return it to the time domain, to see if it has removed some of the error.

I can't find an Inverse Power Spectrum FFT and i'm not sure what filter to use?

I would appreciate if you could share your knowledge with me again.

kindest regards,

Fraser
0 Kudos
Message 6 of 9
(7,695 Views)
Do you really need to filter your signal in the time domain? Why not using a "traditional" time domain filtering? In both case a filtering will have to settle but if you are using a time domain (infinite impulse response) type filter, the settling will be concentrated at the beginning of your signal, while a frequency domain filtering (truncation of your spectrum and inverse FFT) will result in symmetrical "artifacts" (and you most likely will loose the control of your settling time length). Frequency domain filtering is a little tricky to handle.

Furthermore, once you have computed your power spectrum, you can not re-create your (filtered) time signal because you've lost your phase information. The correct procedure would
be to perform a Real-FFT, then truncate your resulting complexe spectrum and finally compute the Inverse-Real-FFT to re-compute your time signal. The needed VI can be found in the "low-level" Analyze-->> Signal Processing-->>Frequency Domain palette.
0 Kudos
Message 7 of 9
(7,695 Views)
I'll try that.

Thanks,

Fraser
0 Kudos
Message 8 of 9
(7,695 Views)
Regarding Time Domain Filtering:
You can easily filter your time domain signal using the waveform-based high-level VIs. Try for example the Digital IIR Filter.vi located in your Analyze-->>Waveform Conditionning palette.

Make sure your signal is a Waveform, that is includes a t0 and a dt value. You can set t0=0 if you want, but make sure dt = 1 / Fs, where Fs is your sampling frequency (200 Hz ?). To create a waveform, use the Build Waveform primitive in your Waveform palette.

Filter Settings: Try Bandpass Filter, Topology = Butterworth, Order = 4, Lower Fc and Higher Fc according to your signal.
0 Kudos
Message 9 of 9
(7,695 Views)