Documente Academic
Documente Profesional
Documente Cultură
CALICUT
Submitted by:
Ch.Uday B140817EC
G.Manoj B140346EC
J.Sudheer B140817EC
K.Vineel B140798EC
Christy B120885EC
1) Aim :
2) Theory :
Modulation is an important and necessary part of digital communication
systems which is performed for providing the signal immunity to noise and for
wireless transmission. Modulation is the process of varying one or more
properties of a periodic waveform, called the carrier signal, with a modulat-ing
signal that typically contains information to be transmitted. In digital
communication systems, there are three main forms of modulation.
The signals used for modulation are s0(t) = ¢ (t) and s1(t) = - ¢ (t). The Bit Error
Rate decreases with an increase in SNR. This is shown by the SNR curve.
3)Code
1)Baseband processing code:
close all;
clear all;
message=rand (1,1024)
message=2.*message-1
numsymb = numel(message) %Random message signal
for i=1:numsymb
if(message(i)>>0)
message(i)=1
else
message(i)=-1
end
end %signal rounded to range -1 to 1
binary=[]
vp=1
t=200
for i=1:numsymb
if(message(i)>>0)
binary=[binary ones(1,t/2).*vp]
else
binary=[binary ones(1,t/2).*(-vp)]
end
end
t=[2/t:2/t:numsymb]
snrdb=0:2:14
snr=10.^(snrdb/10) %snr values stored in an array
ber=zeros(1,numel(snr))
Eb=vp.^2
iter_max=2000;
for count =1:numel(snr)
avgerror=0
N_max=Eb/snr(count)
for iter=1:iter_max
error=0
noise=sqrt(N_max(2)*)randn(1,numsymb) %noise added to signal
received=message+noiise %Recieved signal
for i=1:numsymb
if(message(i)==1&&received(i)<0)||(message(i)== -1 &&received(i)>0)
error=error+1 %maximum likelihood decoding
end
end
error=error/numsymb
avgerror=avgerror+error
end
ber(count)=avgerror/iter_max
end
ber_theoretical=0.5.*erfc(sqrt(snr)) %theoretical error
semilog y(snrdb,ber_theoretical,'k=') %error curves
hold on
grid on
semilog y(snrdb,ber,'y*')
legend('theoretical','simulation')
axis([min(snrdb),max(snrdb,10.^(-5),10.^(-1)])
title('comparison of bit error rates-baseband')
x label ('snr inn db')
y label ('bit error rate')
hold off;
scatter plot (binary)
clear all;
close all;
message = rand(1, 1024);
message = 2*message - 1;
numsymb = numel(message);
for i=1:numsymb
if message(i)>0
message(i)=1;
else
message(i)=-1;
end
end
binary=[];
vp=1;
T=200;
Rb = 1;
for i=1:numsymb
if(message(i)==1)
binary = [binary ones(1, T/2)*vp];
elseif(message(i)==-1)
binary = [binary ones(1, T/2)*(-vp)];
end
end
t = 1:1:1024;
t2 = 0.01:0.01:1024;
f = 5;
trans = message.*cos(2*pi*f*t); %modualted signal
toPlot = binary.*cos(2*pi*f*t2); %modualted signal to plot
cosSig = cos(2*pi*f*t2);
figure
hold on;
title('Comparison of Signals');
subplot(3,1,1);
plot(t2(1:500), cosSig(1:500), 'k');
title('Carrier signal');
xlabel('Time Axis');
ylabel('Amplitude');
subplot(3,1,2);
plot(t2(1:500), binary(1:500), 'b');
title('Message signal');
xlabel('Time Axis');
ylabel('Amplitude');
subplot(3,1,3);
plot(t2(1:500), toPlot(1:500), 'r');
title('BPSK Modulated signal');
xlabel('Time Axis');
ylabel('Amplitude');
hold off;
scatterplot(trans); %original constellation diagram
snrdb = 0:2:14;
snr = 10.^(snrdb/10);
ber = zeros(1, numel(snr));
Eb = vp^2;
iter_max=10;
f = 5;
y=[];
for count=1:numel(snr)
avgerror = 0;
N_max = Eb/snr(count);
for iter=1:iter_max
error=0;
noise = sqrt(N_max/2)*randn(1,numel(trans));
received = trans + noise;
demodulated = received.*cos(2*pi*f*t); %demodulated signal
for i=1:numsymb
if((message(i)==1 && demodulated(i)<0)||(message(i)==-
1&&demodulated(i)>0))
error = error+1;
end
end
error = error/numsymb;
avgerror = avgerror + error;
end
ber(count) = avgerror/iter_max;
end
scatterplot(demodulated); %modified scatter plot
ber_theoretical = 0.5*erfc(sqrt(snr));
figure;
semilogy(snrdb, ber_theoretical, 'k-');
hold on;
grid on;
semilogy(snrdb, ber, 'r*');
legend('Theoretical','Simulation');
axis([min(snrdb), max(snrdb) 10^(-5) 1]);
title('Comparison of Bit Error Rates - Bandpass modulated');
xlabel('SNR in dB');
ylabel('Bit Error Rate');
hold off;
figure;
subplot(2,1,1);
stem(message(1:10));
title('Original message');
xlabel('Time Axis');
ylabel('Amplitude');
subplot(2,1,2);
stem(demodulated(1:10));
title('Demodulated impulses');
xlabel('Time Axis');
ylabel('Amplitude');
Plots
4 Inferences
1. Before the addition of noise, it is observed that the modulated signal has
only two constellation points corresponding to the positive and negative
peak of the polar signal.
2. The Bit Error Rate is found to reduce with increase in SNR. The simulated
results are found to be in close agreement to the actual values.