LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Min & Max frequency of a waveform in LV 7.1

Solved!
Go to solution

I am modifying an old program written in LV 7.1

Over a 2 second period the nominal 60Hz sinusoidal waveform drifts to about 63Hz and then corrects. So during that 2 seconds the frequency is in flux, changing until it resettles at 60Hz. It is old style waveform data - just an array of single precision.

What is the easiest way to determine the peak frequency during this period?

 

thanks,

lmd2 

 

Lawrence M. David Jr.
Certified LabVIEW Architect
cell: 516.819.9711
http://www.aleconsultants.com
larry@aleconsultants.com
0 Kudos
Message 1 of 27
(4,966 Views)

Probably the easiest way would be to perform a FFT  Power spectrum analysis on the signal coming in. The peak of the power spectrum will follow the frequency of the signal coming in as it drifts between 60 and 63Hz.

 

FFT power Spectrum.JPG

National Instruments
Applications Engineer
0 Kudos
Message 2 of 27
(4,939 Views)

Thanks, but I am not following. I just dropped that function on to my diagram, and ran it. It returns an array (well over a hundred elements) starting out at 5.8 increasing to nearly 1800 and then tapering off to zero. How does this tell me if my peak frequency was 62.9 or 62.71 or whatever?

 

I am trying to use Peak Detector.vi (found in signal processing/Time Domain palette) which returns the location (sample #) of each peak (or valley) then calculating number of samples between peaks by sample rate (60KHz). Then I can calculate the apparent frequency of each cycle and pull out the max and min. 

But the VI returns a lot of false peaks so I am trying to filter the false peaks

If your way is better I will gladly use it but how do I use that huge array of scalers to determine min and max frequency values?

Lawrence M. David Jr.
Certified LabVIEW Architect
cell: 516.819.9711
http://www.aleconsultants.com
larry@aleconsultants.com
0 Kudos
Message 3 of 27
(4,935 Views)

I posted a VI here (LV 7.0) see if it help. Just a warning this VI is set to run then open. And the exit is in the toolbox icon (red door)

http://forums.ni.com/ni/board/message?board.id=170&thread.id=163587



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 4 of 27
(4,928 Views)

thanks, but not really a MAX more of an average.

Apparently there is no function that calculates the peak to peak frequency of each cycle, and returns a MAX and MIN

i.e. if I use the cursors and return a sample of 10 complete cycles, the frequencies may ramp from 61.2 to 63.9 over that span

I want to return those MIN & MAX values 

 

wouldn't be so bad if the Peak Detection.vi didn't return so many bogus 'peaks'

 

Thanks anyway 

lmd2 

Lawrence M. David Jr.
Certified LabVIEW Architect
cell: 516.819.9711
http://www.aleconsultants.com
larry@aleconsultants.com
0 Kudos
Message 5 of 27
(4,916 Views)

Great, sounds like your on the right track. The cluster that is output from the FFT Power Spectrum.vi contains three things: Initial Frequency (f0), Deference in Frequency between magnitudes (df), and Magnitude of Power Spectrum. As you said, you can use the Peak Detection.vi to find the locations of these peaks and use that index to multiply by df and ad f0 in order to find the frequency.

 

If you are getting more peaks and valleys than you want, then you'll probably need to increase the threshold so only your global peak is found.

 

Another method that came to mind was using the Pulse Measurement.vi under Signal Processing>>Waveform Measurements. This can return the period of a cycle which can be inversed to the frequency and ultimately built in to an array that we can find the min and max value of.

National Instruments
Applications Engineer
0 Kudos
Message 6 of 27
(4,917 Views)

Okay, this seems to be what I am dealing with:

 (see attached .doc)

 

 any clever suggestions would be appreciated

thanx

 

 

 

Message Edited by lmd2 on 03-18-2010 03:08 AM
Lawrence M. David Jr.
Certified LabVIEW Architect
cell: 516.819.9711
http://www.aleconsultants.com
larry@aleconsultants.com
0 Kudos
Message 7 of 27
(4,904 Views)
I have some problems in understanding your problem. Perhaps it is me. But could you elaborate somewhat. Also perhaps post a indicator/control chart with the data made default values 


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 8 of 27
(4,907 Views)
Sorry, could be hard to understand, attached is a screenshot of an actual acquisition, and then again zoomed in. What is obvious is that the amplitude jumps up and settles back down; not so obvious the frequency is doing the same. within 7 or 8 cycles the frequency goes from 60Hz to 64Hz (zoom1). if I move the left cursor in (zoom2) you see that the low frequency is now about 62Hz - the smallest frequency of that neighborhood (the waveform subset between the cursors). This is the functionality what we need, however it isn't accurate. I calculate frequency by # of samples from a peak to the following peak but this introduces errors because peak detection is not absolute (see my previous word doc). What we really need is instantaneous frequency on a wave form that is constantly changing frequency 
Lawrence M. David Jr.
Certified LabVIEW Architect
cell: 516.819.9711
http://www.aleconsultants.com
larry@aleconsultants.com
Download All
0 Kudos
Message 9 of 27
(4,893 Views)

mathematically, zero-crossings may be more accurate than peak detection, if one of the palettes had something to return an array of all the zero crossings, than from zero to zero would be half the frequency, and probably more stable. 

anyone remember seeing a function that will return all zero crossings from a non-repetitive waveform?

 

or another approach entirely  ...

Lawrence M. David Jr.
Certified LabVIEW Architect
cell: 516.819.9711
http://www.aleconsultants.com
larry@aleconsultants.com
0 Kudos
Message 10 of 27
(4,880 Views)