Mathematica: Discrete Fourier Transform

Click For Summary

Discussion Overview

The discussion revolves around the use of Mathematica to perform a discrete Fourier transform (DFT) on a function represented by discrete values. Participants explore the output of the Fourier command and inquire about the inclusion of phase information in the results.

Discussion Character

  • Technical explanation, Conceptual clarification, Debate/contested

Main Points Raised

  • One participant, Niles, expresses confusion about the output of the Fourier command in Mathematica, noting that it only contains numerical values without phase factors.
  • Another participant suggests that Mathematica computes a specific formula for the DFT, providing a mathematical expression for clarity.
  • There is a question regarding whether the output represents amplitudes or something else, indicating uncertainty about the interpretation of the results.
  • A later reply provides a detailed explanation of how to calculate the magnitude and phase angle from the DFT output, introducing additional formulas for these calculations.
  • Participants discuss the need for further experimentation and understanding of the phase information related to the Fourier transform results.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the interpretation of the Fourier output, with some expressing confusion and others providing clarifications. Multiple viewpoints on the nature of the output and the inclusion of phase information remain present.

Contextual Notes

Some participants reference specific Mathematica commands and formulas, but there are unresolved questions about the definitions and implications of phase and amplitude in the context of the DFT.

Who May Find This Useful

Individuals interested in using Mathematica for signal processing, particularly those seeking to understand discrete Fourier transforms and their outputs.

Niles
Messages
1,834
Reaction score
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
Does anybody know this? I feel bad "bumping" the thread, but I am in real trouble if I can't work this out.
 
Post the relevant code.
 
Here you go (the values of F are in the table)

Code:
four = Fourier[{0.5,1.0,3.0,5.0}]
 
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} ?
 
But I really don't know what it is that Mathematica is calculating? The amplitudes or what?
 
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:

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

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

the first value computed by Mathematica is:

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

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.
 
I will have to think about this. Thanks!
 
If x(n) represents the time-domain data, the formula for an N-point discrete Fourier transform is given by

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

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:

<br /> X(m) = X_\textrm{real}(m) + iX_\textrm{imag}(m) = X_\textrm{mag}(m) \textrm{ at an angle of }X_\theta(m)<br />

the magnitude of X(m) is simply

<br /> X_\textrm{mag}(m) = |X(m)| = \sqrt{X_\textrm{real}(m)^2 + X_\textrm{imag}(m)^2}.<br />

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

<br /> X_\theta(m) = \tan^{-1} \left(\frac{X_\textrm{imag}(m)}{X_\textrm{real}(m)}\right).<br />

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.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K