Discrete Fourier Transform of NDsolve in Mathematica?

In summary, the conversation was about using the InterpolatingFunction created by NDSolve to perform a discrete Fourier transform. The suggestion was to create a Table of equally spaced points and then do Fourier on the table, but this only resulted in a table of interpolating functions. The correct way to use the InterpolatingFunction was not immediately obvious. An example of the process was shown using the equations and plot provided.
  • #1
Catrin
3
0
I want to do a discrete Fourier transform of the solution I have found using NDSolve, however, because the NDSolve creates Interpolating functions rather than numbers I can't do this. Any help is appreciated. I've attatched the file I'm working with.

Catrin
 

Attachments

  • Problem.zip
    19.3 KB · Views: 273
Physics news on Phys.org
  • #2
Use the InterpolatingFunction to create a Table of equally spaced points and then do Fourier on the table?
 
  • #3
That's what I tried, but I just get a table of interpolating functions.
 
  • #4
It is sometimes "less than obvious" how to correctly use an InterpolatingFunction.

In[1]:=eq1 = {D[a[t], {t, 2}] + 0.22 (a[t])^2 + a[t]==0, a[0]==2, a'[0]==0}

Out[1]={a[t]+0.22a[t]^2+a''[t]==0,a[0]==2,a'[0]==0}

In[2]:= timesol01=NDSolve[eq1,a, {t,0,200}];

In[3]:=Table[First[a[t]/.timesol01],{t,0,200}]

Out[3]=
{2.,0.759429,-1.40946,-2.76245,-3.0405,-2.28904,-0.466852,1.58763,1.71456,-0.\
252706,-2.15986,-3.01434,-2.83345,-1.58573,0.552881,1.98694,0.957919,-1.22436,\
-2.6816,-3.05752,-2.40789,-0.677208,1.44126,1.82006,-0.0364096,-2.02039,-2.\
97895,-2.89475,-1.75264,0.340689,1.94796,1.14587,-1.03115,-2.59077,-3.06543,-\
2.51646,-0.882344,1.27765,1.90243,0.180197,-1.87073,-2.93423,-2.9465,-1.90977,\
0.125161,1.88374,1.32079,-0.830714,-2.48981,-3.06428,-2.61483,-1.08103,1.\
09918,1.96031,0.395086,-1.71108,-2.88007,-2.98884,-2.05685,-0.0915471,1.79535,\
1.48022,-0.62413,-2.37863,-3.05405,-2.70311,-1.27225,0.908322,1.99273,0.\
606058,-1.54176,-2.81631,-3.02187,-2.1937,-0.307455,1.68423,1.62185,-0.412673,\
-2.25715,-3.03472,-2.78143,-1.45516,0.707557,1.99915,0.81078,-1.36319,-2.\
74282,-3.04569,-2.32024,-0.520773,1.55216,1.7435,-0.197828,-2.12536,-3.00622,-\
2.84995,-1.62909,0.499359,1.97946,1.00682,-1.17596,-2.65945,-3.06039,-2.43647,\
-0.729919,1.40119,1.84326,0.0187196,-1.98329,-2.96847,-2.90881,-1.79353,0.\
286117,1.93399,1.19168,-0.980831,-2.56606,-3.066,-2.54244,-0.933512,1.23359,1.\
91951,0.235077,-1.83108,-2.92136,-2.95815,-1.94812,0.0701023,1.86351,1.36288,-\
0.778733,-2.46252,-3.06254,-2.63822,-1.13038,1.05175,1.97099,0.449173,-1.\
66895,-2.86477,-2.99811,-2.0926,-0.146573,1.76919,1.518,-0.570791,-2.34873,-3.\
05,-2.72395,-1.31955,0.858138,1.99684,0.658774,-1.49723,-2.79856,-3.02879,-2.\
22683,-0.361975,1.65257,1.65473,-0.358335,-2.22464,-3.02835,-2.79977,-1.50022,\
0.655263,1.99662,0.861512,-1.3164,-2.72258,-3.05029,-2.35075,-0.574364,1.\
51551,1.77098,-0.142899,-2.09023,-2.99751,-2.86581,-1.67178,0.445571,1.97033,\
1.05494,-1.1271,-2.63668,-3.06267,-2.46436,-0.782212,1.3601,1.86491,0.0737764,\
-1.94558,-2.95739,-2.92224,-1.83374,0.231426,1.91842,1.23655,-0.930117,-2.\
54072,-3.06598}

In[4]:= Plot[Evaluate[First[a[t]/.timesol01]],{t,0, 4*Pi}]

Out[4]=<<<plot snipped>>>
 
  • #5
Thank you, that really helped.
 

What is the Discrete Fourier Transform (DFT) of NDsolve in Mathematica?

The Discrete Fourier Transform of NDsolve in Mathematica is a mathematical tool used to analyze and process data that is represented as a discrete sequence of values. It converts a signal from its original domain (often time or space) to a representation in the frequency domain, where the signal's frequency components can be viewed and manipulated.

How do I perform a DFT of NDsolve in Mathematica?

To perform a DFT of NDsolve in Mathematica, you can use the built-in function Fourier. This function takes in a discrete data sequence as its argument and returns the Fourier coefficients, which represent the amplitudes and phases of the signal's frequency components.

What is the purpose of using a DFT of NDsolve in Mathematica?

The purpose of using a DFT of NDsolve in Mathematica is to analyze and manipulate signals in the frequency domain. This can be useful for tasks such as filtering out unwanted noise from a signal, identifying dominant frequency components, and extracting information from a signal that may not be easily visible in the time or space domain.

What is the difference between a DFT and a continuous Fourier Transform?

The main difference between a DFT and a continuous Fourier Transform is that a DFT operates on a discrete data sequence, while a continuous Fourier Transform operates on a continuous function. This means that a DFT can only analyze signals that are sampled at discrete points in time or space, while a continuous Fourier Transform can analyze signals that are continuous over a range of values.

Can I use the DFT of NDsolve in Mathematica for non-periodic signals?

Yes, you can use the DFT of NDsolve in Mathematica for non-periodic signals. However, it is important to note that the DFT assumes periodicity in the data, so it may not accurately represent the signal's frequency components if the signal is not periodic. In these cases, other techniques such as the Fast Fourier Transform (FFT) may be more suitable.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
399
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
248
  • Calculus and Beyond Homework Help
Replies
5
Views
328
  • Linear and Abstract Algebra
Replies
4
Views
884
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • Differential Equations
Replies
4
Views
2K
  • Calculus and Beyond Homework Help
Replies
6
Views
1K
Back
Top