# PHYCS 3730/6720 Lab Exercise

#### Exercise 1. Numpy Discrete Fourier Transforms

A pure cosine signal
```   f(t) = cos(w*t)
```
is sampled 128 times at the times t = j Dt for j = 0,1,...,127. The frequency is nu = 20/(128*Dt) = 0.15625/Dt. The angular frequency is w = 2 pi times that. So the discrete signal is
```   fj = cos(40*Pi*j/N)
```
for N = 128. Compute its discrete Fourier transform and plot the power spectrum. Note that the power spectrum looks continuous, but that is only because pyplot connects the 128 plot points. Copy your Python commands (your interactive session) to the answer file. Then also put the answers to the questions below in your answer file:
• Without looking at the Fourier transform, determine the frequency (not the angular frequency!) of the original signal.
• Where are the peaks in the power spectrum P[m]? That is, precisely at what values of m? You can check this by printing selected components.
• 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 m? (It should agree with the frequency of the signal in the vector you get with np.fft.fftfreq.)
• Why are there two peaks? See the discussion in the notes about identities for Fourier transforms of real data.

#### Exercise 2. Damped oscillation

Use Python 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 Python commands you used. Then answer these questions:
• At what value of m does the positive frequency peak in the power spectrum occur? What is the frequency in units of 1/Dt. 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?