Mathematica: Discrete Fourier Transform

In summary, Mathematica computes the discrete Fourier transform of a list of frequencies, but the table only has real numbers and no phase factor.
  • #1
Niles
1,866
0
Hi all

I have a function F, which depends on a discrete variable x, and I need to Fourier Transform it. I have put all the values of F in a table.

Then I have used the command "Fourier" on the table, which - according to http://reference.wolfram.com/mathematica/ref/Fourier.html - results in the discrete Fourier Transform. But the new table only contains pure numbers, no phase factor. Why is that, and is there a way to include the phase?


Niles.
 
Physics news on Phys.org
  • #2
Does anybody know this? I feel bad "bumping" the thread, but I am in real trouble if I can't work this out.
 
  • #3
Post the relevant code.
 
  • #4
Here you go (the values of F are in the table)

Code:
four = Fourier[{0.5,1.0,3.0,5.0}]
 
  • #5
Mathematica {4.75+0 i,-1.25-2. i,-1.25+0 i,-1.25+2. i}
Why not {9.50 + 0 i, -2.50 + 4. i, -2.50 + 0.i, -2.50 - 4.i} ?
 
  • #6
But I really don't know what it is that Mathematica is calculating? The amplitudes or what?
 
  • #7
Hi Niles. It's easy to see what Mathematica is computing. Just do a help on Fourier and hit the more info button. For a list {u_n}, Mathematica creates a list {v_n} such that:

[itex]v_s=\frac{1}{\sqrt{n}}\sum_{r=1}^n u_r e^{2\pi i(r-1)(s-1)/n}[/itex]

so for your list {0.5, 1.0, 3.0, 5.0},

the first value computed by Mathematica is:

[itex]v_1=\frac{1}{\sqrt{n}}\sum_{r=1}^n u_r e^{2\pi i(r-1)(1-1)/n}=4.75[/itex]

Don't know what you mean by phase factor or amplitude though. Try reading through all the various options in the More info. Maybe you'll spot something that can help you.
 
  • #8
I will have to think about this. Thanks!
 
  • #9
If x(n) represents the time-domain data, the formula for an N-point discrete Fourier transform is given by

[tex]
X(m) = \sum_{n=0}^{N-1} x(n) e^{-2\pi imn/N}, \qquad m=0\ldots N-1.
[/tex]

You'll often be interested in the magnitude and power contained in each X(m). If you represent an arbitrary DFT output value, X(m), by its real and imaginary parts:

[tex]
X(m) = X_\textrm{real}(m) + iX_\textrm{imag}(m) = X_\textrm{mag}(m) \textrm{ at an angle of }X_\theta(m)
[/tex]

the magnitude of X(m) is simply

[tex]
X_\textrm{mag}(m) = |X(m)| = \sqrt{X_\textrm{real}(m)^2 + X_\textrm{imag}(m)^2}.
[/tex]

The phase angle of X(m) is then defined by

[tex]
X_\theta(m) = \tan^{-1} \left(\frac{X_\textrm{imag}(m)}{X_\textrm{real}(m)}\right).
[/tex]

Therefore, if you calculate the DFT of your data as

Code:
 In[1]:= four = Fourier[{0.5,1.0,3.0,5.0}]
Out[1]:= {4.75 + 0. I, -1.25 - 2. I, -1.25 + 0. I, -1.25 + 2. I}

the phase is obtained simply as

Code:
 In[2]:= phases = ArcTan[Im[four]/Re[four]]
Out[2]:= {0., 1.0122, 0., -1.0122}

Is that what you're looking for?
 
Last edited:
  • #10
I will try and experiment with it; I'll keep you posted. Thanks so far.
 

1. What is the Discrete Fourier Transform (DFT) in Mathematica?

The DFT is a mathematical tool used to convert a finite sequence of equally spaced samples of a function into a series of complex numbers. In Mathematica, the DFT is implemented as the Fourier function, which takes a list of data points and returns a list of complex amplitudes.

2. How is the DFT calculated in Mathematica?

Mathematica uses the Fast Fourier Transform (FFT) algorithm to efficiently calculate the DFT. This algorithm breaks down the DFT into smaller sub-problems that can be solved recursively, resulting in a faster computation time compared to the traditional DFT calculation.

3. What is the difference between the DFT and the Discrete Cosine Transform (DCT) in Mathematica?

The DFT and DCT are both methods for transforming a signal from the time domain to the frequency domain. The main difference is that the DFT represents the signal using complex numbers, while the DCT represents it using real numbers. In Mathematica, the DCT is implemented as the FourierDCT function.

4. Can the DFT be applied to non-periodic signals in Mathematica?

Yes, the DFT can be applied to any finite sequence of data points, regardless of whether the signal is periodic or not. However, the interpretation of the resulting Fourier coefficients may differ for non-periodic signals compared to periodic signals.

5. How can the DFT be used in data analysis and signal processing in Mathematica?

The DFT is a powerful tool for analyzing signals and extracting useful information from them. It is commonly used in applications such as image processing, audio analysis, and data compression. In Mathematica, the DFT can be used to filter out noise, identify frequencies present in a signal, and perform spectral analysis.

Similar threads

  • Linear and Abstract Algebra
Replies
4
Views
884
  • Calculus and Beyond Homework Help
Replies
6
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • Calculus and Beyond Homework Help
Replies
1
Views
776
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • Topology and Analysis
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
Back
Top