Message Boards Message Boards

0
|
457 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Help with Fourier[]: understanding how discrete Fourier transforms works

I want to show myself how Discrete Fourier Transforms work. I've hit a barrier and would appreciate help getting over it. I assumed if I created a list of measurements of a known frequency and then transformed it, I would get a peak at that frequency. I'm not certain about that assumption. But even if it's right, I'm not getting the results I expect. My plot of frequencies doesn't reach the known frequency, and the peak is off by more than a bin width. If you can help, the goal should be to adjust my expectation or this code so that they match. Side note: I'm not good with Mathematica code shortcuts.

freq = 102;
t[\[Theta]_] := \[Theta]/(freq 2 Pi)
tbl = Table[{t[ \[Theta]], Sin[\[Theta]]}, {\[Theta], 0, 10 (2 Pi),  
    Pi/500}];
fourier = Fourier[N[tbl[[All, 2]], 24]];

ListPlot[tbl,
 PlotRange -> {{0, .1}, All}, AxesLabel -> {"s", ""}, 
 PlotLabel -> Row[{"\[Omega] = ", Quantity[freq, "Hertz"]}]]

ListPlot[
 Transpose[{(Range[Length[tbl]] freq/Length[tbl])[[1 ;; -2]], 
   Abs[fourier][[1 ;; -2]]}],
 PlotRange -> {(*{1/2,110}*){101.8, 102.2}, All}, 
 AxesLabel -> {"Hz", ""},
 PlotLabel -> "Fourier Spectrum", Joined -> True]
Clear[t, tbl, fourier, freq]
POSTED BY: Jay Gourley
3 Replies
Posted 13 days ago

I found an explanation on the stack exchange that not only answers my question but explains details about the Fourier Transform that make the Wolfram documentation more understandable.

https://mathematica.stackexchange.com/questions/85139/what-do-the-x-and-y-axis-stand-for-in-the-fourier-transform-domain/85167#85167

POSTED BY: Jay Gourley
Posted 13 days ago

That's great, Arnoud Buzing. Thanks. I found a fairly complete explanation on the stack exchange. I'll post a link it as a solution to my question.

POSTED BY: Jay Gourley

Jay,

I cheated and asked an AI (but had to make small corrections to its answer)

Can you see if this is correct (I think it is...):

https://www.wolframcloud.com/obj/arnoudbuzing/Published/fourier-02.nb

POSTED BY: Arnoud Buzing
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract