Sei sulla pagina 1di 1


Department of Electrical and Electronics Engineering

EE 306 Signals & Systems II MATLAB Homework 2

Due: 18 April 2013 Thursday, until 23:59 Submit Electronically to the Assignments Section at METU-Online Course Page

In this homework, you are going to implement the basics of a Double SideBand (DSB) communication system in a very similar fashion to the one you have learnt in the first DEMO hour. You may safely use any code segment from the first DEMO, for which the .m file is already uploaded to METU-Online.

Follow the steps given below, in order to lowpass filter a square wave, modulate it using DSB modulation and demodulate it. The demodulated signal is expected to be a close approximation to the input message signal, which is the square wave. Don’t forget to name all your axes on your plots and to give the units where applicable. You are also required to submit all of your code segments. Please, submit all your work in a single file.

1- Generate a zero-mean (no DC component) sampled square wave with a peak value of 0.5 Volts extending

from t = 0 up to t = 10 seconds. The fundamental frequency is required to be 200 Hz. Don’t forget to choose a suitable sampling rate (Hint: You may need to read steps 5-6-7 before deciding on the sampling rate.) Give a time domain plot for the square wave in a narrow duration so that the periodic characteristic is visible. 2- Plot the magnitude of the Fourier Transform of the message signal (remember fft(.) and fftshift(.)

functions and the Nyquist rate). The plot is to be normalized so that the peak magnitude is 1.


The square wave generated theoretically has infinite bandwidth. Before modulating it (remember the carrier signal running at a relatively high frequency and the mixing operation), we have to filter the high- frequency components to limit the utilized bandwidth. Then using the fir1(.) function which is also described in the DEMO, now create a lowpass filter. The bandwidth of the filter is set such that only the third and the fifth harmonics of the square wave in addition to the fundamental component appear at the output. Be careful that with lowpass filter design, you don’t need to give the start of the passband but only the stop frequency. As an example, filter_order denoting the order of the filter to be designed and pass_freq denoting the stop frequency, you may use the following commands

filter_pass_region_lp = [pass_freq] / (sampling_rate / 2); % Pass region for the lowpass filter h_lowpass_t = fir1(filter_order, filter_pass_region_lp); % Impulse response for the lowpass filter


Apply the created lowpass filter on the message signal. Plot the magnitude of the Fourier Transform of the

filtered signal. On the same plot also observe the frequency response of your filter remembering the “hold on” command. Again the responses on your plot should be normalized so that the peak magnitudes are 1.


Now translate your filtered baseband signal to higher frequencies by applying the mixing operation (multiplying your filtered signal with a high-frequency sinusoidal known as the carrier signal). The carrier signal should be at 25 kHz.


Plot the magnitude of the Fourier Transform of the bandpass signal that you have obtained in the previous step. Keep in mind that your sampling rate at this point should be high enough to avoid aliasing.

7- Now assuming that the bandpass signal of the previous parts is observed at the receiver end of a communication system, the inverse operation of modulation is to be realized at the receiver:

demodulation. The demodulator for this DSB system is assumed to be of product type. This means the received signal is initially multiplied by a sinusoidal that has the same frequency and the phase with the sinusoidal used in mixing at the transmitter side. Hence multiply the received signal with the same sinusoidal used in mixing and plot the magnitude of the Fourier Transform of this product signal.


As you observe in the previous step, the product signal has two replicas of the message signal: one at the baseband (around 0 Hz) and the other one at twice the carrier frequency, i.e., around 50 kHz. We are now going to filter out the replica at the high frequency to obtain the baseband signal which is expected to be the message signal that we wish to detect. Therefore, finally, apply a lowpass filter that has the same bandwidth as the desired message signal and plot the magnitude of the Fourier Transform of the product type detector output. Also give a time domain plot for this output signal and comment on the waveform.


Try and give plots for the case that all harmonic components up to and including the 11 th is included in the baseband signal by repeating the steps 3 up to 8.

Submit Your Solutions Electronically to the Assignments Section at METU-Online Course Page as a Single Document (Office file or PDF) Including the Annotated Plots and MATLAB Code Segments