LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I extract the frequency of a (possibly noisy) signal?

I have this input from DAQ and I want to find its frequency. I was wondering how can I do that with Labview basic.

 

 

What I was thinking was since the signal is sinusoidal, to have a zero-detection and extract the time index of the signal. If so, then my question will be:

a) how to extract the time index of a signal? Does the "Get time array" under waveform works?

b) in case of noisy signal, I may have some faulty zero-detection. How do you think I can fix that? (I can use a low pass filter but it looks like it's not in the labview basics)

 

Thanks.

0 Kudos
Message 1 of 25
(7,032 Views)

Run an FFT, if you have that function available. It will put out spikes at the frequencies which are in the wave. You can plot it to see this. You can then set some threshold where you say if it's above this value, then that frequency is there.

0 Kudos
Message 2 of 25
(7,021 Views)

Hi,

 

FFT is one solution. If the signal amplitude is very small (compared to the noise) you can use auto-correlation. Auto-correlation performed on several set of data can help you find periodical signals which have the amplitude smaller than the noise.

 

The VI for this is Auto-Power Spectrum. I've never used this function in LabView but theoretically it should be the best solution for what you want.

 

Paul

0 Kudos
Message 3 of 25
(7,014 Views)

Thanks for the replies. The thing is that I just have labview basic and these VIs need some additional toolkits. Is there any way that I can do that without upgrating my labview?

0 Kudos
Message 4 of 25
(6,999 Views)

Some other solutions:

 

1. You can use some external DLL for the FFT function. One of the best is FFTW (www.fftw.org). I've used it in many of my Visual C++ applications but it can be also used in LabView. If you have FFT you can do very easy also the auto-correlation.

 

2. If the data amount is small you can use the simple definition for Discrete Fourier Transformation. Only if the number of samples is low. Otherwise it will take forever to compute DFT.

 

3. Use a filter to remove noise (choose one base on the noise type) and a threshold with hysteresis. This is easy and fast to be done but not very effective. 

0 Kudos
Message 5 of 25
(6,988 Views)

Thanks PauliQ. 

That was pretty useful. But my sampling rate are not that small, so calculating DFT cannot be practically implemented. 

Using external filter can be good, but the thing is that I wanna use a zero-crossing detection, so any small noise/disturbance can mess it up. 

 

I don't know if there is any other way to calculate the frequency other than zero-crossing detection with the basic Labview, and it sounds to pricy for me to pay 1500$ for just frequency calculation of a signal. 

0 Kudos
Message 6 of 25
(6,977 Views)

I wanted to said: software digital filter. Not external. It's easy to be build. Choose a FIR or IIR based on the frequencies , noise type, signal bandwidth and use it before applying the threshold or zero cross detection (threshold = 0 ).

Message 7 of 25
(6,960 Views)

Baran,

 

How noisy is your signal?  In particular how many false zero crossings do you see for each real one?  If the number of false crossings is small (<2 or 3), then a simple 3-5 point smoothing filter would probably clean up the signal enough to apply a regular zero crossing algorithm.

 

If the number of false crossings is much larger then you need to do something much more complicated.

 

How many samples per cycle do you have at the highest frequency you want to measure?

 

Do you ever have interfering signals (as opposed to random noise)?

 

Please post what you have tried with some typical data saved as default.

 

Lynn

 

0 Kudos
Message 8 of 25
(6,957 Views)

Oh, thanks for the replies. I don't know why I didn't get any email for the updates.

I don't think I would have that much disturbance signals (in the same frequency range as opposed to noise). So I should be fine about that.

As for the noise, if I want to use IIR or FIR then I need to have Digital Filter Design Toolkit, which I don't (if you are saying I can make it on my own, I appreciate any further help)

My signal should not be that noisy, since I can even have an external filter. The problem is the zero-crossing detection algorithm is so sensitive and I am not sure how can I ignore the faulty detected zero-crossings.

 

I have not got the data yet, since we are waiting for a part to be purchased, but I need to do this in parallel so I can finish the project as soon as the part will be received.

 

Thanks again for the responses.

0 Kudos
Message 9 of 25
(6,938 Views)

OK.

 

SInce you expect a fairly clean signal, try the smoothing technique before your zero crossing.  I may be able to put together a simple example later.

 

Lynn

0 Kudos
Message 10 of 25
(6,921 Views)