Professional Documents
Culture Documents
Presentation Outline
Presentation Outline
Presentation Outline
Expected Background
Presentation Outline
Source
Modulator
Channel
Destination
Demodulator
Simulate a Source
Source
Modulator
Channel
Destination
Demodulator
Simulate a Source
% Amplitude
% Frequency
10
Simulate a Source
Complete MATLAB Script
[Prog1.m]
11
Simulate a Source
12
Simulate a Source
Assignment #1
[Prog2.m], [Prog3.m]
13
Simulate Modulation
Source
Modulator
Channel
Destination
Demodulator
14
Amplitude Modulation
Simulate with built-in functions
fs = 8000;
fc = 300;
t = [0:0.1*fs]'/fs;
m = sin(20*pi*t);
v = ammod(m,fc,fs);
%
%
%
%
%
[Prog4.m]
figure(1)
subplot(2,1,1); plot(t,m);
subplot(2,1,2); plot(t,v);
mr = amdemod(v,fc,fs);
% Plot m on top
% Plot v below
% Demodulate v to produce m
figure(2);
subplot(2,1,1); plot(t,m);
subplot(2,1,2); plot(t,mr);
% Plot m on top
% Plot mr below
15
Amplitude Modulation
16
Amplitude Modulation
17
Amplitude Modulation
18
Amplitude Modulation
Continued .
v = (1+m/Vc).*c;
Vm
sin 2f mt sin 2f ct
Vc
% DSB-FC modulation
19
Amplitude Modulation
Complete MATLAB Script
[Prog5.m]
% Message
% Carrier
% Modulated Wave
20
Amplitude Modulation
21
Amplitude Modulation
Assignment #2
[Prog6.m]
22
Amplitude Modulation
Assignment #2 (Contd)
[Prog7.m]
23
Demodulation
Demodulate DSB-SC with filter
[Prog8.m]
24
Demodulation
25
Demodulation
Ideal Demodulation of DSB-SC
[Prog9.m]
26
Demodulation
27
Source
Modulator
Channel
Destination
Demodulator
28
Simulate Channel
Introducing AWGN
[Prog10.m]
fs = 10^5; N = 10^5;
t = 1/fs:1/fs:N/fs;
fm = 2; fc = 10^3;
m = sin(2*pi*fm*t);
c = sin(2*pi*fc*t);
v = m.*c;
SNRdB = 10; SNR = 10^(SNRdB/10);
vn = var(v)/SNR;
n = sqrt(vn)*randn(1,N);
v = v + n;
r=zeros(1,N); n=fs/fc;
for k=1:fc
mr((k-1)*n+1:k*n)=2*v((k-1)*n+1:k*n)*c((k-1)*n+1:k*n)'/n;
end
figure(1)
subplot(2,1,1); plot(t,m);
subplot(2,1,2); plot(t,mr); axis([0 1 -1 1])
A. Chandra, ECE Deptt., NITD
29
Simulate Channel
30
Presentation Outline
31
Source
Modulator
Channel
Destination
Demodulator
32
Simulate BPSK
Simulation
%This program simulates BER
clear all; close all; clc;
num_bit=100000;
max_run=20;
Eb=1;
SNRdB=0:1:9;
SNR=10.^(SNRdB/10);
[Prog11.m]
of BPSK in AWGN channel%
%Signal length
%Maximum number of iterations for a single SNR
%Bit energy
%Signal to Noise Ratio (in dB)
hand=waitbar(0,'Please Wait....');
for count=1:length(SNR)
%Beginning of loop for different SNR
avgError=0;
No=Eb/SNR(count);
%Calculate noise power from SNR
33
Simulate BPSK
Simulation (Contd.)
[Prog11.m]
N=sqrt(No/2)*randn(1,num_bit);
%Generate AWGN
Y=s+N;
%Received Signal
for k=1:num_bit %Decision device taking hard decision and deciding error
if ((Y(k)>0 && data(k)==0)||(Y(k)<0 && data(k)==1))
Error=Error+1;
end
end
Error=Error/num_bit;
avgError=avgError+Error;
end
A. Chandra, ECE Deptt., NITD
%Calculate error/bit
%Calculate error/bit for different runs
%Termination of loop for different runs
Simulating Communication Systems with MATLAB
34
Simulate BPSK
Simulation (Contd.)
[Prog11.m]
BER_sim(count)=avgError/max_run;
end
BER_th=(1/2)*erfc(sqrt(SNR));
close(hand);
semilogy(SNRdB,BER_th,'k');
%Plot BER
hold on
semilogy(SNRdB,BER_sim,'k*');
legend('Theoretical','Simulation',3);
axis([min(SNRdB) max(SNRdB) 10^(-5) 1]);
hold off
35
Simulate BPSK
36
References
[1] http://www.mathworks.com/matlabcentral/
[2] http://www.freewebs.com/acwebpage/teaching.htm
[3] B.P. Lathi and Z. Ding, Modern Digital and Analog
Communication Systems, Oxford University Press,
International 4th edition, 2010.
[4] J.G. Proakis, M. Salehi, and G. Bauch, Contemporary
Communication Systems using MATLAB, Thomson/ CLEngineering, 2nd edition, 2003.
37
Thank You!
Questions???
aniruddha.chandra@ieee.org
A. Chandra, ECE Deptt., NITD
38