Re: spectrum
- To: mathgroup at smc.vnet.net
- Subject: [mg39537] Re: [mg39532] spectrum
- From: Sseziwa Mukasa <mukasa at jeol.com>
- Date: Sat, 22 Feb 2003 03:37:36 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
On Friday, February 21, 2003, at 04:11 AM, thomas martinuzzo wrote: > > I'm a french student in a Engeenering school and I want to do spectrum > with > mathematica. > For exemple: How do to have the spectrum of > x(t)= Sin[(2Pi/440)*t] > I assume you want a discretely sample spectrum. The Fourier transform of Sin[(2Pi/440)*t] contains Delta functions, if you use UnitStep to eliminate nonzero values for t < 0 you can get an approximate continuous plot with Plot[Evaluate[FourierTransform[Sin[2*Pi*t/400] UnitStep[t], t, w]], {w, -Pi/100, Pi/100}] To get a discrete Fourier transform of length m and sample rate r use ListPlot[Transpose[{Table[i/( m*r), {i, -Quotient[m, 2], Quotient[m, 2] - 1}], RotateRight[Re[Fourier[ Table[Sin[2*Pi*i*r*m/400], {i, 0, m - 1}], FourierParameters -> {-1, 1}]], Quotient[m, 2]]}], PlotJoined -> True, PlotRange -> All] The first list is to provide the frequencies along the x axis. Choose m and r appropriately. Regards, Ssezi