1D DFT: Example #3: step (edge)

Sampled sequence

fs = 10 ; xd = Table[-1, {20}] ~ Join ~ Table[1, {20}] ; If[OddQ[Length[xd]], xd = Drop[xd, -1 ... e, FrameTrue, Axes {True, False}, ImageSize500, AspectRatio1/3] ;

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

View as "image"

ShowImage[{xd}, Round[500/Length[xd]], 2, -2] ;

[Graphics:../HTMLFiles/index_32.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_34.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_36.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_38.gif]

View as "image"

tmp = Arg[(Last /@ fft) + .0000001 ] ; RowBox[{RowBox[{ShowImage, [, RowBox[{{tmp}, ,, Round[500/Length[tmp]], ,, RowBox[{1.2, π}], ,, RowBox[{RowBox[{-, 1.2}], π}]}], ]}], ;}]

[Graphics:../HTMLFiles/index_40.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_42.gif]

View as "image"

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

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

Rearrange phase plot of DFT as a function of frequency f

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

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

View as "image"

tmp = Last/@ FourierRearrange[Arg[Last /@ fft + .0000001], fs] ; RowBox[{RowBox[{ShowImage, [, ... und[500/Length[tmp]], ,, RowBox[{1.2, π}], ,, RowBox[{RowBox[{-, 1.2}], π}]}], ]}], ;}]

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

Filtering in the frequency domain

lpf = Filter[Length[xd], fs, {0, 2}] ;

DiscreteListPlot[FourierRearrange[lpf, fs], Magenta, PlotRangeAll,   ImageSize500, FrameTrue, AspectRatio1/3, ImageSize500] ;

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

DiscreteListPlot[InverseFourier[lpf * (Last /@ fft)] // Chop, Blue, FrameTrue, Axes {True, False}, ImageSize500, AspectRatio1/3] ;

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

View as "image"

tmp = InverseFourier[lpf * (Last /@ fft)] // Chop ; ShowImage[{tmp}, Round[500/Length[tmp]], 2, -2] ;

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


Created by Mathematica  (February 5, 2004)