
ECGR 4123/5191
Computer Problem #2
3) Partial Solution to Problem 3
Script File Used for the entire Problem
% Script File - DSB-SC Modulation and Demodulation
% Information signal is a Rectangular Pulse with 1st Null Bandwidth of
% 2 rad/s. The carrier frequency, wo = 2*pi*100 rad/s.
% Set sampling frequency for time domain. This sampling frequency is used
% consistently throughtout the entire example. Sampling frequency needs
% to be at leat twice the highest frequency.
%
% Highest frequency 2*wo + 8*2. The 8*2 rad/s term is required to take
% into account the high frequency terms in our information signal.
% To obtain "better" plots the sampling frequency is sellected to be 20
% times the carrier frequency.
close all
clear all
wo=2*pi*100;
fs = 20*wo;
a0 = 2*pi*6; % Select -3dB down point of filter to be at 6 Hz
h = exp(-a0.*[0:1/fs:1]); % Note there are better approaches to
%designing this filter, but this method is straight forward
freqz(h,1,2^15,fs) % Plot of frequency response of the filter
t=-10:1/fs:10; % time variable
x=((t+1)>0) - ((t-1)>0); % rect information signal
y = x.* cos(wo*t); % Modulated signal
z = y.* cos(wo*t); % Demodulated signal prior to LPF
xhat = filter(h,1,z); %Demodulated signal
dtft(x,fs,'Message signal');
dtft(y,fs,'Modeulated signal');
dtft(z,fs,'Demodulated signal prior to LPF');
dtft(xhat,fs,'Received signal');
plot(t,x,'r', 'linewidth', 2)
hold on
plot(t,xhat/sum(h.^2),'--')