Homework 3: Spectral Analysis
Due: 10 am, September 19 (Thursday).
In this week's lab, we will modulate a carrier wave with
a PRN code sequence. In particular,
we'll look at the signal in the frequency domain. This
allows us to see the spread spectrum nature of the GPS
signal. First, we need to know how to generate a sine
wave, and compute the spectrum of this unmodulated carrier.
This is the focus of this week's prelab.
Note: this can be a stand-alone program - it does not have to be a function.
Most of you should you have learned rudimentary spectral analysis
terms in ASEN 3300. Those who have not taken 3300 or a similar class
can drop by my office for additional help.
Generate a sine wave and power spectrum of given characteristics:
- N: number of points: 213
- Ts: sampling period: 0.001 seconds
- frequencies of the carrier signals (sine waves), F1 = 50 Hz
and F2 = 10 Hz with amplitudes of 5 and 2, respectively.
Your program must follow these steps:
- Define N
- Define sampling period Ts (in seconds)
- Define sampling frequency Fs = 1/Ts
- Use N points and Tsto generate time signal starting from 0.
- Define a sine wave function (SWF) using F1 and F2
(SWF = amplitude*sine(2*pi*time*freq)).
- Plot the SWF in the time domain between 0 and 0.4 seconds.
- Y = fft(SWF) computes the Fast Fourier Transform.
- Ps = Y.*conj(Y)/N computes the power spectral density.
- F = Fs*(0:N/2-1)/N creates the frequency axis,
starting at zero and ending at the Nyquist frequency.
- Plot frequency vs. power spectral density (Ps(1:N/2)). Don't worry
about the y-axis units, but do define the x-axis units.
Turn in: your code and two plots.