Showing results for 
Search instead for 
Did you mean: 

How can I get a trustful FFT spectrum from an unevenly spaced time


I I trying to find the best frequency spectrum. I used the interpolation function to get evenly spaced time dt. But the frequency spectrum does not give me the right value (that I can get using the peaks detection function. I get an inverse logarithmic curve instead.

I used also extract tone function but it is not giving the right value too.

I attached the vi.




0 Kudos
Message 1 of 11



It would help a lot if we had some of your data. Please run your VI again so that the Signal and Time arrays contain typical data. Then from the Edit menu select Make Current Values Default and save the VI. Post that VI.



Edit: Please tell us what the "right values: should be and how you determine what they are.



Message 2 of 11

Your raw data is not very periodic. What exactly are you expecting as a result?


Where is the data coming from and what is the FFT supposed to show?


Your inteval is not a multiple of the wavelength, so you have spectral leakage. Also the first ~80 seconds is quite different from the rest.

LabVIEW Champion Do more with less code and in less time
Message 3 of 11

You are right. The signal starts not periodic but after certain variable time, it becomes periodic.

Actually the data comes from the integration of stiff differential equations. This is why the dt is not constant. So, I used the interpolation to overcome this problem.

The FFT is to show the frequency of the oscillations. I expect a peak  corresponding to the frequency.

These data comes from certain chemical reactions and the imperfections of the periodicity should be normal at certain extend.

I attached the VI again with some real data as requested.

I am also wondering if the FFT can be used to compare 2 signal and detect if the phenomenon is chaotic.



0 Kudos
Message 4 of 11

Once you remove the large initial transient, the data is rather periodic. 


What I did is rather similar to your approach. I created a time ramp with millisecond resolution (assuming that the times in the Time array are in seconds). Then I interpolated the Time and Signal data at the time points in that ramp. To remove the startup transient Array Subset is used with a threshold time set manually. I found that 110 seconds worked well.


Both spectrum measurments and Extract Tone Information VIs give similar results. The first spectral peak is at 4.7 mHz with significant harmonics as would be expected from the waveform.  That is one cycle every 213 seconds. The DC component could be reduced by subtracting the mean before the spectral analysis but it is probalby not worth bothering.


There is some extra code left over from some things I tried and ended up not using.  I did not take the time to remove it.


Do you have any idea what the spectrum should look like when the system is chaotic?



Message 5 of 11

Thank you Lynn.

So why do these results not show in the FFT spectrum. I expect to see a single peak corresponding to the periodicity.Why am I getting a broad logarithmic line instead?

The chaos should appear by comparing to spectra starting from very close points and after a while the 2 signal starts slowly to give very distinct signal without diverging completely (they can cross each other again).




0 Kudos
Message 6 of 11

@ziedhosni wrote:

So why do these results not show in the FFT spectrum. I expect to see a single peak corresponding to the periodicity.Why am I getting a broad logarithmic line instead?


You only get a single peak if the signal is sinusoidal. Your signal is not. To get the complicate shape of each period you need a significant amount of higher harmonics, i.e. other frequencies.


Overall, I don't think FFT is the right way to analyze your data.

LabVIEW Champion Do more with less code and in less time
Message 7 of 11

Thank you Altenbach.

If the FFT is not the right way to analyse this type of signal, do you suggest any other technique?

What do you think Labview can do for me to analyse this signal?




0 Kudos
Message 8 of 11

This is not a LabVIEW problem, but an analysis problem independent of the programming language used.


Do you have collection of real or simulated datasets that show the various states that you need to distiguish? How variable is the atomic shape of a single period? What is the possible range of the fundamental frequency? can you measure for a longer time, e.g. more periods?


Does the system go from normal to chaotic in a single trace or is every trace either one or the other?



LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 9 of 11

Actually Have hundreds of datasets of these oscillations with various amplitude and frequency.

I think the shape of the period can change slightly among the datasets.

My objective is actually to evaluate how broad is the range of frequency.

Indeed, I can measure for much longer time the oscillations.

The last question is tricky and I think that both phenomena can happen as the signal can start steady then periodic then chaotic then periodic...and obviously, this behaviour change from one signal to the other.


0 Kudos
Message 10 of 11