<<

ECE 642 - Assignment 4

When plotting either by hand or with MATLAB, please label all the axes with specic numerical value and units of measure. MATLAB may be used only when explicitly stated. Include your MATLAB code and plots.

1. A signal x(t) given by a rectangle of duration 1 second and height 1 Volt is modulated into a carrier of 10 Hz. We wish to observe the Fourier transform of the modulated signal y(t) = x(t) cos(2π10t), and to design a basic demodulator. To this end, perform the following steps. Please include MATLAB code and plots. a. Calculate the Fourier transforms of x(t) and that of y(t) by hand. b. Draw the absolute value of the Fourier transforms of x(t) and that of y(t) by hand (carefully). c. Based on the Fourier transform of y(t) choose a suitable sampling fre- quency 1/Ts. d. Using MATLAB create vectors x and y that represents the signals x(t) and y(t). Plot the baseband signal x and the passband signal y. You can use the following lines of code by lling in the blanks represented as . . . :

Ts=...; %SET YOUR SELECTED SAMPLING PERIOD Ts t=[0:Ts:100]; tzoom=[0:Ts:2]; %reduced length time axis to zoom in the time signal N=length(t); x=...; %baseband signal figure(1); plot(tzoom,x(1:length(tzoom))); %plot the baseband signal c=cos(...); %carrier y=...; %modulated signals (passband) hold on; %with hold on we can plot more curves in the same figure plot(tzoom,y(1:length(tzoom)),'r'); %plot the passband signal in red e. Plot the magnitude of the Fourier transforms of x(t) and of y(t) in two separate gures. You can use the following lines of code by lling in the blanks represented as . . .  (compare your result with points a. and b.): f=...; figure(2) plot(f,Ts*abs(fftshift(fft(x)))); %Fourier transform of x(t) hold on plot(f,...,'r'); %Fourier transform of y(t) in red -- Please note the effect of the !

1 f. Consider now the operation of a basic demodulator. The demodulator rst calculates z(t) = y(t) cos(2π10t) and then performs low-pass ltering in order to recover x(t). We know that

x(t) 1 z(t) = + x(t) cos(2π20t). 2 2 Sketch its Fourier transform by hand (carefully). g. Plot the Fourier transform of z(t) in MATLAB (compare with your plot at the previous point): z=...; Z=...; %Fourier transform of z figure(3) plot(f,abs(Z)); h. Perform a low-pass lter on z(t) with cut-o (i.e., largest) frequency 10 Hz in order to recover x(t) and observe the eect in the frequency and in the time domains: H=...; %frequency response of the desired low-pass filter: Can you explain how this was obtained? Zf=Z.*H; %filtered version of z(t) hold on; plot(f,abs(Zf),'r'); %plot the filtered Fourier transform in red -- does it look similar to the desired Fourier transform of x(t)? zf=...; %perform the inverse Fourier transform to obtain the filtered signal in time domain figure(1) plot(tzoom,2*zf(1:length(tzoom)),'k'); %plot the filtered signal in the time domain -- how does it compare to the signal before filtering? (Note that the 2 factor compensates for the 1/2 factor present in z(t))

2. Consider a passband signal whose in-phase part is a rectangle of unit height and duration 1 second, while the quadrature part is a rectangle of height equal to 2 and duration 2 seconds (both starting from time zero). The carrier frequency is 20 Hz. a. Plot the passband signal in the time domain using MATLAB: Ts=...; %sampling period t=[0:Ts:100]; fc=20; %carrier frequency xi=...; %in-phase signal xq=...; %quadrature signal xz=xi+j*xq; %complex envelope

2 xc=sqrt(2)*real(...); %passband signal (you can also use the formula with cosine and sine) tzoom=[0:Ts:3]; %reduced time axis for plotting in the time domain ltzoom=length(tzoom); plot(tzoom,xc(1:ltzoom)); b. Calculate the Fourier transform of the passband signal using MATLAB. N=...; f=...; Xc=...; c. Plot real and imaginary parts of the Fourier transform of the passband signal using MATLAB. d. Using MATLAB, calculate the Fourier transform of the complex envelope. e. Plot real and imaginary parts of the Fourier transform of the complex envelope using MATLAB. f. Which of the above Fourier transforms satisfy Hermitian symmetry? Why?

3