Handwritten Text Recognition for manuscripts and early printed texts
Bpsk simulation
1. Date-09/09/13
SATISH KUMAR/ECE/16/B-1
Experiment-6
Object:- Write a program to simulate the transmitter and receiver for BPSK.
Software required:- MATLAB 7.8.0(R2009a)
Theory:AM and FM modulation schemes can be used to transmit digital signals and this allows
for the channel to be shared. As digital data forms the message instead of speech and music, it is
preferred that these two systems are called ASK and FSK instead.
Recall that ASK uses the digital data’s 1s and 0s to switch a carrier between two
amplitudes. FSK uses the 1s and 0s to switch a carrier between two frequencies. An alternative to
these two methods is to use the data stream’s 1s and 0s to switch the carrier between two phases.
This is called Binary Phase Shift Keying (BPSK). Figure 1 below shows what a BPSK signal
looks like time-coincident with the digital signal that has been used to generate it. Notice that,
when the change in logic level causes the BPSK signal’s phase to change, it does so by 180º. For
example, where the signal is travelling towards a positive peak the change in logic level causes it
to reverse direction and head back toward the negative peak (and vice versa).
You may find it difficult to see at first but look closely and you’ll notice that alternating
halves of the BPSK signal’s envelopes have the same shape as the message. This indicates that
BPSK is actually double-sideband suppressed carrier (DSBSC) modulation. That being the case,
BPSK generation and the recovery of the data can be handled by conventional DSBSC
modulation and demodulation techniques (explained in Experiments 5 and 7 respectively).
With a choice of ASK, FSK and BPSK you might be wondering about which system
you’ll most likely see. All other things being equal, BPSK is the best performing system in terms
of its ability to ignore noise and so it produces the fewest errors at the receiver. FM is the next
best and AM is the worst. On that basis, you’d expect that BPSK is the preferred system.
2. Date-09/09/13
Coding:clc;
close all;
clear all;
input=[1 0 1 0 0 1 1];
Rb=100;
Fs=16*Rb;
Ts=1/Fs;
Tb=1/Rb;
p=length(input);
amplitude=1;
for count=1:length(input)
for temptime=1:16
if(input(count)==0)
output(count,temptime)=-1*amplitude;
else
output(count,temptime)=1*amplitude;
end
end
end
k1=reshape(output',1,112);
t=0:Ts:Tb*length(input)-Ts;
subplot(2,2,1);
plot(t,k1);
axis([0 0.07 -1.5 1.5]);
xlabel('time');
ylabel('amp');
title('modulating signal');
Fc=10e1;
t1=0:9/(112*Fc):9/Fc-(.03/Fc);
y=cos(2*pi*Fc*t);
subplot(2,2,2);
plot(t1,y);
xlabel('time');
ylabel('amplitude');
title('Carrier Signal');
z=k1.*y;
subplot(2,2,3);
plot(t1,z);
xlabel('time');
ylabel('amplitude');
title('Modulated Signal');
n=awgn(z,10);
subplot(2,2,4);
plot(t1,n);
xlabel('time');
ylabel('amplitude');
title('Noisy BPSK Signal');
v=z.*y;
ks=length(v);
integrationBase=0:1/Fs:Tb-Ts;
for i=0:(length(v)/(Tb*Fs))-1
w(i+1)=trapz(integrationBase,v(int32(i*Tb*Fs+1):int32((i+1)*Tb*Fs)));
end
for i=0:(length(v)/(Tb*Fs))-1
if(w(i+1)>0)
SATISH KUMAR/ECE/16/B-1