Experiment No.: 03 Name of The Experiment: MATLAB Code of Product Detection of DSB-SC Demodulation Objective

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Experiment No.

: 03
Name of the Experiment: MATLAB Code of Product detection of DSB-SC
demodulation

Objective:
1. To understand the operation theory of double sideband suppressed carrier DSB-SC
demodulator.
2. To design and implement the MATLAB Coding of DSB-SC demodulator.
3. To explain the spectrum of the DSB-SC demodulator.

Learning Outcome: After completing this experiment the students will be able to:
1. Learn about working principle of a product detector of a double sideband suppressed carrier
demodulator.
2. Design DSB-SC demodulator by MATLAB Coding.
3. Explain the time-domain and the frequency domain representation of demodulated signal.
Theory:
Write theory according to the discussion in the class

MATLAB Coding:
clc;
close all;
clear all;

fs = 1000000; %sampling frequency


T = 1/fs; %sampling period
N = 10000; %length of the signal
t = (0:N-1)*T; %time vector
fm = 1000; %frequency of message signal (Hz)
fc = 10000; %frequency of carrier signal (Hz)

message = sin(2*pi*fm*t); %message signal


carrier = sin(2*pi*fc*t); %carrier signal

m_size = size(message);
c_size = size(carrier);

dsb_sig = message.*carrier; %DSB-SC signal

figure(1) %time-domain representation of the signals

subplot(3,1,1)
plot(t,message)
xlabel('time (s)')
ylabel('amplitude of m(t)')

subplot(3,1,2)
plot(t,carrier)
xlabel('time (s)')
ylabel('amplitude of carrier')

subplot(3,1,3)
plot(t,dsb_sig)
xlabel('time (s)')
ylabel('amplitude of DSB-SC')

mess = fft(message);
carr = fft(carrier);
dsb = fft(dsb_sig);

mess_spec = fftshift(mess); %zero centered fft of message signal


carr_spec = fftshift(carr); %zero centered fft of carrier signal
dsb_spec = fftshift(dsb); %zero centered fft of DSB-SC signal

mess_mag_spec = abs(mess_spec)/N; %magnitude spectrum of message signal


carr_mag_spec = abs(carr_spec)/N; %magnitude spectrum of carrier signal
dsb_mag_spec = abs(dsb_spec)/N; %magnitude spectrum of DSB-SC signal
f_Hz = ((-N/2):(N/2-1))*(fs/N); %frequency axis range in Hz
f_normalized = ((-N/2):(N/2-1))*(fs/N)/fs; %frequency axis range in normalized frequency

figure(2) %time-domain representation of the signals

subplot(3,1,1)
plot(f_Hz, mess_mag_spec)
axis([-12000 12000 0 0.5])
xlabel('frequency (Hz)')
ylabel('magnitude of m(t)')

subplot(3,1,2)
plot(f_Hz, carr_mag_spec)
xlabel('frequency (Hz)')
ylabel('magnitude of carrier')
axis([-12000 12000 0 0.5])

subplot(3,1,3)
plot(f_Hz, dsb_mag_spec)
xlabel('frequency (Hz)')
ylabel('magnitude of DSB-SC')
axis([-12000 12000 0 0.5])

%% Demodulation of DSB-SC Signal

y = 2*dsb_sig.*carrier; % multiplication of DSB-SC signal by carrier

Y = fft(y);
Y_spec = fftshift(Y);
Y_mag_spec = abs(Y_spec)/N;

figure(3)
plot(f_normalized(N/2+1:end), Y_mag_spec(N/2+1:end));
% LOW pass filter design

[a, b] = butter(6, .01, 'low');


H = freqz(a, b, N/2);

hold on
plot(f_normalized(N/2+1:end),abs(H))
xlim([0 .05])

dsb_demod = filter(a,b,y);

dsb_demod_fft = fft(dsb_demod);
dsb_demod_spec = fftshift(dsb_demod_fft);
dsb_demod_mag = abs(dsb_demod_spec)/N;

plot(f_normalized(N/2+1:end), dsb_demod_mag(N/2+1:end),'k','LineStyle','--'); % demoulated


spectrum

figure(4) % comparison of original message and demodulated wave-form


plot(t, message);
hold on
plot(t, dsb_demod, 'r','LineStyle','--')

Results:

Discussion:
Student Task:
1. Write a MATLAB code on the given task during the class.
2. Collect the images of waveforms/spectrum.
3. Explain the waveforms/spectrum

You might also like