Message Boards Message Boards

0
|
76 Views
|
0 Replies
|
0 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
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