Download Mathematica notebook [right click / save as]

Download Mathematica notebook [right click / save as]

In this article, we use a Fast Fourier Transform to study a dynamical system in the frequency domain. This conversion is very illuminating on the behavior of the dynamical system as it will point out the frequencies at which the system might become unstable or nonlinear. Using the results obtained in the first article of this series, Mathematica can easily convert the data into the frequency domain. This is accomplished by first generating a table containing the values obtained in the numerical solution and then applying a discrete Fourier transform to that data. The code that does this is given by

(* Generate a table containing the numerical solution *)Voila!

yvalues = Table[(x[t] /. s1)[[1]], {t, Tend}];

(* Apply a discrete Fourier transform on that data and plot it*)

ListLinePlot[Abs[Fourier[yvalues]], PlotRange -> All]

Download Mathematica notebook [right click / save as]

Cite as:

Saad, T. "Solving Differential Equations with Mathematica - Part III: Frequency Domain".
Weblog entry from
Please Make A Note.
http://pleasemakeanote.blogspot.com/2008/05/solving-differential-equations-with_25.html

I've tried to use the commands to identificate the oscillation frequency. The problem is that this frequency depends on the number of data values that the program evaluates from the solution of the differential equation. That's the reason why the frequency obtained doesn't match (in the problem I'm solving) the one I'm seeing in the solution of the differential equation.

ReplyDeleteHave you encountered any similar problem?

thanks,

Federico

I agree. I have encountered a similar problem. However, as Mathematica discusses in its documentation, the FFT should be able to pick up the frequencies. But in practice, that does not work all the time.

ReplyDeleteIf you find a better way of doing it, please let me know.

cool

ReplyDeleteThank you very much for the post. It worked as a confirmation for what I did. I think that the best accuracy in the frequency spectrum is given when you make a Table with increment less than 0.0001. In a i7 Lap Top with 8 Gb RAM the best result is given when you give a space in the form of {t,0,Tend,0.0001}.

ReplyDelete