University of Central Oklahoma: ENGR 3324L Lab 7: Applications of the Fourier Transform in Communications: Amplitude Modulation (Two Weeks Lab) Lab objective: 1- Being able to find the Fourier Transform of aperiodic signal, 2- Being able to apply Fourier Transform and its properties to applications in communications. Prelab: 1- Find the Fourier transform X(ω) of the aperiodic signal shown in Fig. 1. x(t ) A t -0.5 0.5 Fig. 1 Lab Procedures: 1 Introduction Modulation is used to shift the spectrum of a signal to a higher frequency band before transmission for two reasons. The first reason is to minimize the length of the antenna used for transmission. The length of the antenna should be at least half the longest wavelength λ present in the transmitted signal. For low frequency the wavelength is very large, λ = c/f, where c is the speed of light. The second reason is to shift the spectrums of different signals to different frequency bands, so the receiver can separate the received signals by using bandpass filters whose central frequencies equal the corresponding carrier frequencies. Amplitude modulation is common in broadcasting (AM radio and TV video broadcasting) as well as in point to-point communications (walkie-talkies). The signal information is used to alter the amplitude of the carrier signal. Usually the frequency of the carrier signal is very large (10 MHz) in comparison to the modulated signal (voice between 20 Hz to 4000Hz). In this lab we will study Amplitude modulation of a sinusoidal signal that consists of three low frequencies (dc, 5, and 10Hz) and the carrier is a sinusoidal signal with frequency equal 40 Hz. TASK 1: The Sinc Function and the Scaling Property. The Fourier transform of a rectangular has been shown in the lecture and in the textbook to be a sinc function as shown below If x(t) = rect(t/τ) then X(ω) = τ sinc(ωτ/2) In this task you will investigate the effects of the pulse time-width τ on the spectrum bandwidth and magnitude. First you need to build a function in Matlab that will plot a sinc function based on the parameters τ and ω. These two parameters will be passed to the Matlab function sincFun. function [y]= sincFun(taw, omega) %function compute sin(ωτ/2)/(ωτ/2) %taw = τ omega = ω y=ones(size(omega)); i = find(omega~=0); %find the indix of the zero in the vector omega n = find(omega==0); y(i) = sin(omega(i)*taw/2)./(omega(i)*taw/2); y(n) = 1; plot(omega, y); Now investigate the effects of the pulse width τ on the spectrum bandwidth of the main loop and the spectrum magnitude. In the time domain, the pulse width is compressed for small value of τ and expanded for a larger value. Consider the cases where the pulse width is τ = 0.5, τ = 1, and τ = 2 second. Plot the spectrum for each case and state the relationship between the pulse width τ and the width of the main loop. From the plot for τ = 1 sec, find the first three values of ω for which the spectrum equals zero. Verify your measurements analytically. You can use the following command to plot the sinc function for different values of frequencies ω. >> omega =[-6*pi: 0.01: 6*pi]; >> plot(omega, sincFun(0.5, omega),'k-', omega, sincFun(1, omega),'k:', omega, sincFun(2, omega),'k--'); TASK 2: Amplitude modulation of a simple signal In this task you will be writing two functions that will be used more frequently during this lab session. Name the first function AmSpectrum.m which will compute the magnitude of the Fourier spectrum of the signal passed to it. Name the second function AmPlot.m which will plot the three signals (the modulator, the carrier, and the modulated signals) passed to the function. MATLAB (AmSpectrum function) function X = AmSpectrum(x) % AmSpectrum calculates the spectrum X of a signal x % x: signal % X: spectrum of signal x % Use the help command in matlab to learn more about the fftshift and fft functions X = abs(fftshift(fft(x))); MATLAB (AmPlot function) function AmPlot(idx,m,c,u,rng) % AmPlots function plots the three modulation signals % idx: x index (it can represent time or frequency) % m: modulating signal % c: carrier signal % u: modulated signal % rng: range of x axis to plot (optional) if nargin < 5; rng = 1; end % default value for rng figure; subplot(3,1,1); plot(idx,m); grid on; axis([rng*min(idx) rng*max(idx) min(m)-0.1 max(m)+0.1]); subplot(3,1,2); plot(idx,c); grid on; axis([rng*min(idx) rng*max(idx) min(c)-0.1 max(c)+0.1]); subplot(3,1,3); plot(idx,u); grid on; axis([rng*min(idx) rng*max(idx) min(u)-0.1 max(u)+0.1]); How does the rng parameter affect the range of the x axis? TASK 3 In this task you will be generating simple modulator signal m(t) that consist of two frequencies 5 Hz, 10 Hz and a dc. m(t) = cos(2π5t) + 2cos(2π10t) + 3 The carrier signal has a higher frequency 40 Hz. c(t)= cos(2π40t). We will examine the effect of the carrier frequency in shifting the spectrum and the magnitude of the modulated signal. Create a Matlab script M-File and call it FourierSpectrum. The M-file FourierSpectrum will generate the message signal m(t), the carrier signal c(t) and then the modulated signal u(t) = m(t)*c(t). It will also plot the m(t), c(t), and u(t). It will also call the AmpSpectrum function to calculate the spectrums M(ω), C(ω), and U(ω) and plot them. MATLAB (FourierSpectrum M-File) fs = 3000; len = 1; % length of signals in seconds t = (-len/2):1/fs:(len/2); % time index % generate the message signal m(t) fm = 5; % modulator frequency (Hz) m = cos(2*pi*fm*t) + 2*cos(2*pi*2*fm*t) + 3; % generate the carrier signal c(t) fc = 40; % carrier frequency c = cos(2*pi*fc*t); % Modulate the signal u = m.*c; % Let’s plot them in time to see how they look like AmPlot(t,m,c,u,1.1); figure; % Calculate the spectra M = AmSpectrum(m); C = AmSpectrum(c); U = AmSpectrum(u); % Make the frequency index for plotting f = (-fs/2):(1/len):(fs/2); % Now let’s plot them in frequency AmPlot(f,M,C,U,0.04); Can you verify the frequency components in the signal m(t) from its spectrum? Can you tell which frequency component has the highest amplitude? Change the carrier frequency to 80 and repeat the above procedure. You may need to change the frequency range of the x-axis to see all frequency components in the spectrum. Can you verify the carrier frequency from the plots? What is the effect of the time length t?