Note: For our simulations we use Matlab. Matlab only works with discrete signals, not continuous signals, so the simulation is not exact. Some of the things we must do in the simulation are because we are using discrete signals, or samples of continuous signals, and why they are done will not be obvious until you take a class in digital signal processing.

Please follow all the guidelines for computer homework. Homework that does not follow the guidelines will be returned without being corrected.

Computer Homework 2

In this homework you will implement an amplitude modulation and demodulation system. You will modulate and demodulate a signal and view the results in time and in frequency.

First, make a sine wave with a frequency of 1Hz and a sampling frequency of 100Hz. Use the commands from homework 1. This is like the sine pulse, but without the zeros. Next, modulate the sine wave using double sideband transmitted carrier, with a carrier frequency of 10Hz. Finally, demodulate the signal. To make the filter needed in the demodulator, again use the commands from homework 1, and a cutoff frequency of 5Hz. For both modulation and demodulation, use the equations derived in class. Plot the original signal, the modulated signal, and the demodulated signal before and after the filter both in time and in frequency. Only plot the magnitude of the fourier transform for this homework.

To take a Fourier transform in matlab and view the results.

Let x be the signal in time.

>>Xft=fft(x);

>>Xft=fftshift(Xft);

Xft is the Fourier Transform of x. Xft is generally complex, so we can graph the magnitude and phase.

>>Xmag=abs(Xft);

is the magnitude, and

>>Xphase=angle(Xft);

is the Phase.

Since x is a discrete signal, Xft is also discrete, but is similar to the FT we discussed in class. Xft is a sampling of the FT of x and is called the discrete fourier transform. The samples are in frequency, and we need to make the frequency axis to plot Xft. Xft has the same number of points as x. The sampled frequencies are uniformly distributed between

-fs/2 and fs/2. Exaclty which frequencies are sampled depends on whether the number of samples is even or odd. Let Xft have length N. If N is even, then the sampling is from

-fs/2 to fs/2 - fs/N, with a distance of fs/N between samples. We can make the frequency axis as

>>faxis= -fs/2:fs/N:fs/2 - fs/N;

If N is odd, then the axis goes from -fs/2 + fs/2N to fs/2 - fs/2N, with fs/N between each sample.