PHYCS 3730/6720 Lab Exercise
Reading and references:
Answer file lab18.
Exercise 1. Maple Discrete Fourier Transforms
Here is an example Maple session for doing the Fourier transform of a
cosine and producing a vector containing the power spectrum. You will
need Maple version 9 or higher to do this exercise. In our labs you
may need to run the command xmapleV9 & in a terminal window to
get it.
with(DiscreteTransforms);
N := 128;
f := Vector(N,j->evalf[6](cos(40*Pi*(j-1)/N)),datatype=complex[8]);
F := FourierTransform(f,inplace=true);
P := Vector(128,i->Re(F[i]*conjugate(F[i])),datatype=float[8]);
The Vector command sets up a vector f of length N
with components that sample the function f(t) = cos(w*t). The
sampling is at discrete times t = (j-1) * Dt for t
ranging from 0 to 127*Dt. The angular frequency is w
= 40*Pi/(N*Dt). (Note that Dt is the time interval between
sample points. Since we specify the angular frequency w in
terms of Dt, it cancels out in f(t), so we don't need to
give it a numeric value at this point. If it helps, you can think of
it as one second.)
The FourierTransform command generates the Fourier transform
and puts it in the vector F. The next line computes a real
vector containing the squared norm of the Fourier components. Note
that with Maple indexing the Fourier component for zero frequency
appears in F[1] and its power appears in P[1]. More
generally, in this notation we must use i = m+1 to translate
from the indexing in the notes to Maple indexing.
To plot the power spectrum we can use
with(plots);
pointplot({seq([i,P[i]],i=1..128)});
In this first exercise, run the Maple commands to see the result.
Then answer these questions.
- Without looking at the Fourier transform, determine
the frequency (not the angular frequency!) of the original
signal. (Use t_j = (j-1) * Dt and write the cosine term
as cos(2*Pi*v*t_j) Solve for v. (Your answer will
be in terms of the sampling interval Dt.)
- Where are the peaks in the power spectrum P[i]? That is,
precisely at what values of i? You can check your reading
of the plot by simply looking at individual values
of P[i]. Or you can plot the power spectrum over a narrower
range.
- To convert Maple's indexing to those in our notes, we must take
i = m + 1. Considering that the frequency values are
related to the discrete index m through v = m/(N
Dt), what is the frequency of the peak at the lower
index i? (It should agree with the frequency of the
signal.)
- Why are there two peaks? See the discussion in the notes about
identities for Fourier transforms of real data.
Exercise 2. Damped oscillation
Use Maple to construct the power spectrum for the signal f(t) =
exp(-0.2*t/Dt)*cos(0.8*t/Dt) using the same discretization as
above. That is, sample at t/Dt = j = 0,1,...,127. The line
shape you get in power vs frequency is called a Lorentzian.
In your answer file give the Maple commands you used. Then answer
these questions:
- Where is the lower frequency peak in the power spectrum? Give
the frequency in units of 1/Dt and compare it with the
frequency of the cosine in the original signal.
- Estimate the width of the peak at half its height and give its
value in angular frequency (with the 2*Pi
included). That width is related to the decay rate of the
signal. The slower the decay, the narrower the width. If we
write the exponential decay factor as
exp(-Gamma/2*t). Your width should be equal
to Gamma, which, in this case is 0.4/Dt. Is it?