Showing results for 
Search instead for 
Did you mean: 

instanteous frequency




Sorry for my English, I'm french...


I've got a data file which represent a "many-periodic" signal (voltage on Y-axis and time on X-axis) composed of nearly 10 "peaks". I mean it's a waveform signal where the period evolves in time. Moreover, my signal is not symetric and not "zero-centered".

I would like to display the frequency for each moment of my signal, a kind of "instanteous frequency".


Until now, I detect all the peaks and calculate the time between two consecutive peaks in order to estimate only 9 periods, then 9 frequencies...


I'm looking for a better solution which can give me more frequencies in order to plot it as a fonction of the time.


Any idea?


Thank you.





0 Kudos
Message 1 of 16
What are you looking for? Frequency would be the occurance of a repeated "action" which in your case sounds like the peaks of the waveform. If the waveform is non-symmetric, and the frequency is changing with time, the only definitive "identifier" appears to be the peaks.
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5

LabVIEW Champion

0 Kudos
Message 2 of 16

Wikipedia wrote: 
Frequency is the number of occurrences of a repeating event per unit time. It is also referred to as temporal frequency. The period is the duration of one cycle in a repeating event, so the period is the reciprocal of the frequency


So, from this point of do not have a frequency, so how do you want to get any information about this?

I think, what you want to see is the time difference between the peaks.....and your approach seems to solve that already.



CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 3 of 16

Ok, It wasn't clear...


First, here is my data chart, voltage as a fonction of time:


Sans titre.jpg


the period (then the frequency) looks like constant but it doesn't!! i would like to estimate the variation of the frequency, ploting it as a fonction of time.


For example, we can fit the signal with a function as A(x) + B(x)sin(C(x)) where A(x), B(x) and C(x) may be polynomials. 


C(x) should represent the frequency as a fonction of time (Known up to a 2pi factor of proportionality). But I'm not sure, and I don't know how to do...


Is it clearer?


Any ideas? 



Thank you




0 Kudos
Message 4 of 16

The problem in your task is that you have not really sufficient periods for a single frequency analysis. You could try to simplify it like you are more or less already doing: Determine the time it takes from one maximum to the next (or minimum, regarding your task) and take this is "one period(s)". So the frequency is 1/period(s).


I think the biggest issue occurs in the clear identification of those maxima/minima. Given your screenshot, you have to either introduce "deadbands" or appropriate hysteresis for the determination of those points......


Please note, that this approach is a guess of the frequency at best because without proper continuity, the determination of a frequency is (mathematically spoken) not possible.



CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 5 of 16

As Norbert pointed out "frequency" is not well defined for signals which vary non-periodically.  You can define "instantaneous frequency" any way you chose for your signal, but you should be very clear about what assumptions you make in doing so.


Since your signal appears to be fairly clean (high signal to noise ratio), finding successive maxima and minima and the spacing between them is probably the best way.


The Lev-Mar curve fitting routines work well to fit the frequency of a sine wave if you use less than one complete cycle of the wave.  It works poorly for three or more cycles.  Fourier transform techniques work best when you have about 10 or more cycles at the same frequency.  Fitting to your equation "  A(x) + B(x)sin(C(x)) " will probably not work very well.  If you want to use fitting techniques, split the array of data at each maximum and minimum and fit the approximate half cycles to sin(omega*x).   I have had some success with fitting segments of a cycle to a sine curve.


If you wish to use a zero crossing technique, find the maxima and minima as above.  Then locate the midpoint (amplitude) between each maximum, minimum and minimum, maximum pair.  Use the timing of those midpoints as the "zero-crossings."  There will be some error, but due to the nature of your signal any frequency estimate will contain some error. For the image you posted the first midpoint would be at about 1.65 (y-axis) and 450 (x-axis).  The second one would be at about 1.2 and 800.  The estimate for the period of the half cycle containing the first minimum would be 800-450 = 350.  The estimated frequency for a full period based on that half period is 1/(2*350) = 0.00143.



Message 6 of 16

Is there some reason you are not taking the Fourier Transform (FFT) of the data and using the outputs as the coefficients?  There will be some DC term...for the average offset, there will be some harmonics off the step changes in the DC term ... and there will be a very large peak (or two depending on how the frequencies fall between samples) for the sinusodial looking part of the signal...



0 Kudos
Message 7 of 16



The original poster indicated that the frequency is changing over the duration of the signal and that a cycle by cycle measurement is desired.  At least that is the way I read it.   Fourier transform methods do not work well with rapidly changing frequencies.  The FFT need about 10 cycles at constant frequency for good results.



0 Kudos
Message 8 of 16

I would have thought that you could take the FFT of the signal every 500 samples or so and that would give you good enough resolution for one cycle of the sinusoid.


That would divide the frequency domain up into 1/250 of the sample frequency as an increment in frequency.  Then, move the window...


The signal can be windowed as well....




Guess I don't understand the problem.




0 Kudos
Message 9 of 16

Mathematically the Fourier transform is defined by an integral over all time.  This has the effect of taking a long term average over the component at a particular frequency.  If the signal only has a component at that frequency for a very short time, the magnitude of that component in the output of the transform is small.  If the signal segment is not exactly an integral number of cycles, the truncation introduces additional components which look like harmonics and may also contribute a DC component.


The joys of using sampled and truncated data to represent a signal which is modeled as infinitely continuous!  



0 Kudos
Message 10 of 16