03-16-2010 11:48 AM
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
Solved! Go to Solution.
03-17-2010 12:37 PM
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.
03-17-2010 01:00 PM
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?
03-17-2010 01:35 PM
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
03-17-2010 02:20 PM
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
03-17-2010 02:35 PM
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.
03-18-2010 03:07 AM - edited 03-18-2010 03:08 AM
Okay, this seems to be what I am dealing with:
(see attached .doc)
any clever suggestions would be appreciated
thanx
03-18-2010 03:52 AM
03-18-2010 06:34 AM
03-18-2010 06:50 AM
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 ...