# LabVIEW

cancel
Showing results for
Did you mean:

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

Hello,

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.

Thanks,

Zied

Message 1 of 11
(1,813 Views)

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

Zied,

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.

Lynn

Message 2 of 11
(1,777 Views)

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

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. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 3 of 11
(1,764 Views)

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

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.

Message 4 of 11
(1,751 Views)

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

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?

Lynn

Message 5 of 11
(1,736 Views)

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

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).

Thanks,

Zied

Message 6 of 11
(1,721 Views)

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

@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. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 7 of 11
(1,702 Views)

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

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?

Cheers

Zied

Message 8 of 11
(1,689 Views)

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

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. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 9 of 11
(1,685 Views)

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

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.

Message 10 of 11
(1,680 Views)