[go: up one dir, main page]

0% found this document useful (0 votes)
115 views6 pages

Experiment No.: 06 Name of The Experiment: Implementation of Envelope Detection of AM Signal Using MATLAB Coding and Simulink Model Objective

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 6

Experiment No.

: 06
Name of the Experiment: Implementation of envelope detection of AM signal
using MATLAB coding and Simulink model

Objective:
1. To understand the operation theory of envelope detection of AM signal
2. To design and implement envelope detection of AM signal using the MATLAB Coding
3. To design and implement envelope detection of AM signal using the Simulink model
4. To explain the spectrum of the detected signal using envelope detection.

Theory:
Write theory according to the discussion in the class
MATLAB Coding:

clc;
close all;
clear all;

%% Defining the parameters

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)
A = 1; %carrier amplitude

%% Defining message and carrier signal


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

m_size = size(message); % dimension of message signal


c_size = size(carrier); % dimension of carrier signal

%% Defining AM or DSB-LC signal


am_sig = message.*carrier + A*carrier; %AM signal

%% time-domain representation of the signals


figure(1)

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,am_sig)
xlabel('time (s)')
ylabel('amplitude of AM')

%% message, carrier and am signal in the frequency domain

mess = fft(message); % fourier transform


carr = fft(carrier);
am = fft(am_sig);

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


carr_spec = fftshift(carr); %zero centered fft of carrier signal
am_spec = fftshift(am); %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
am_mag_spec = abs(am_spec)/N; %magnitude spectrum of DSB-SC signal

f_Hz = ((-N/2):(N/2-1))*(fs/N); % frequency axis range in Hz


f_normalized = f_Hz/fs; % frequency axis range in normalized frequency

figure(2) %frequency-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, am_mag_spec)
xlabel('frequency (Hz)')
ylabel('magnitude of AM')
axis([-12000 12000 0 0.5])

%% Envelope Detection

[up,lo] = envelope(am_sig); % envelope of AM signal

[a,b] = butter(1,.5e-3,'high'); % high-pass filter to block the DC component


h = freqz(a,b, N/2); % frequency characteristics of the filter
dc_removed = filter(a,b,up);

figure(3)
subplot(2,1,1)
hold on
plot(t,am_sig) % plotting am signal
plot(t,up) % plotting envelope of am signal
xlabel('time (s)')
ylabel('amplitude')
title('AM signal and Envelope');
hold off
subplot(2,1,2)
hold on
plot(t,message)
plot(t,up)
plot(t,dc_removed,'k')
xlabel('time (s)')
ylabel('amplitude')
title('Comparison of message, envelope and DC-blocked signal')
hold off

%% Comparison of the spectrum of recovered signal and original message signal

up_fft = fft(up); % fourier transform of the envelope


up_fft_shift = fftshift(up_fft);
up_mag = abs(up_fft_shift)/N;

dc_rem_fft = fft(dc_removed); % fourier transform of the DC-blocked signal


dc_rem_fftshift = fftshift(dc_rem_fft);
dc_rem_mag = abs(dc_rem_fftshift)/N;

figure(4)
subplot(3,1,1)
plot(f_Hz, mess_mag_spec)
xlabel('frequency (Hz)')
ylabel('magnitude')
title('magnitude spectrum of message signal')
axis([-2000 2000 0 1])
subplot(3,1,2)
plot(f_Hz, up_mag)
xlabel('frequency (Hz)')
ylabel('magnitude')
title('magnitude spectrum of envelope')
axis([-2000 2000 0 1])
subplot(3,1,3)
plot(f_Hz, dc_rem_mag)
xlabel('frequency (Hz)')
ylabel('magnitude')
title('magnitude spectrum of dc-blocked signal')
axis([-2000 2000 0 1])

Simulink Model:

To know the details of the simulink block, watch the class video.
Results:

Discussion:

Student Task:
1. For AM Simulink model, take the modulation index = (last digit of student ID + 1)*0.1.
2. Show the results in the report and explain the waveforms and the spectrum

You might also like