1D DFT: Example #1: single cosine

Sampled sequence: cos(2π t)

x[t_] := Cos[2π t] ; xd = Sampler[x, fs = 10, {0, 4}] ; If[OddQ[Length[xd]], xd = Drop[xd ... e, FrameTrue, Axes {True, False}, ImageSize500, AspectRatio1/3] ;

[Graphics:../HTMLFiles/index_2.gif]

View as "image"

RowBox[{RowBox[{ShowImage, [, RowBox[{{Last /@ xd}, ,, Round[500/Length[xd]], ,, 1.2, ,, RowBox[{-, 1.2}]}], ]}], ;}]

[Graphics:../HTMLFiles/index_4.gif]

Magnitude plot of DFT as a function of index k

fft = DFT[xd] ; g3 = DiscreteListPlot[{#[[1]], Abs[#[[2]]]} & /@ fft, Red, PlotRangeAll, FrameTrue, AxesFalse, AspectRatio1/3, ImageSize500] ;

[Graphics:../HTMLFiles/index_6.gif]

View as "image"

tmp = Log[1 + Abs[Last /@ fft]] ; RowBox[{RowBox[{ShowImage, [, RowBox[{{tmp}, ,, Round[500/Length[tmp]], ,, RowBox[{1.2, Max[tmp]}]}], ]}], ;}]

[Graphics:../HTMLFiles/index_8.gif]

Phase plot of DFT as a function of index k

fft = DFT[xd] ; RowBox[{RowBox[{g4, =, RowBox[{DiscreteListPlot, [, RowBox[{RowBox[{RowBox[{Ro ... , ,,  , AxesFalse, ,,  , AspectRatio1/3, ,,  , ImageSize500}], ]}]}], ;}]

[Graphics:../HTMLFiles/index_10.gif]

Rearrange magnitude plot of DFT as a function of frequency f

g5 = DiscreteListPlot[FourierRearrange[Abs[Last /@ fft], fs], Red, PlotRangeAll, FrameTrue, AxesFalse, AspectRatio1/3, ImageSize500] ;

[Graphics:../HTMLFiles/index_12.gif]

View as "image"

tmp = Log[1 + (Last /@ FourierRearrange[Abs[Last /@ fft], fs])] ; ShowImage[{tmp}, Round[500/Length[tmp]], Max[tmp]] ;

[Graphics:../HTMLFiles/index_14.gif]


Created by Mathematica  (February 5, 2004)