Hello,
I have written matlab codes for plotting of eye patterns for BPSK and QPSK... How to determine bit rate and symbol rate from these patterns....Thanx...
The matlab code for BPSK is follows:
clc;
close all;
clear all;
no_of_bits=10;
no_of_samples=200;
threshold = 0.5;
Fs=30; % Sampling frequency
rand('state',123);
t1=linspace(0, 1, no_of_samples);
w=cos(2*pi*1000*t1);
A = rand(1,no_of_bits); % Generate a random sequence
for i=1:no_of_bits
if (A(i)>=threshold)
A(i)=1;
else
A(i)=0;
end
end
d = A(1:no_of_bits); % Binary sequence
b=2*d-1;
for j=1:length(b)
bpskmod=b(j).*w; % BPSK modulated signal
bpskmod;
received=bpskmod;
end
subplot(2,1,1)
axis([0 1.5 -1.5 1.5])
eyescat(received,0.5,Fs);
Eye pattern for bpsk is as follows:
The matlab code for qpsk is as follows:
clc;
close all;
clear all;
no_of_bits=10;
no_of_samples=200;
Fs=30;
threshold = 0.5;
rand('state',123);
t1=linspace(0, 1, no_of_samples);
inPhaseOsc = cos(2*pi*1000*t1);
quadPhaseOsc = sin(2*pi*1000*t1);
A = rand(1,no_of_bits); % Generate a random sequence
for i=1:no_of_bits
if (A(i)>=threshold)
A(i)=1;
else
A(i)=0;
end
end
d = A(1:no_of_bits); % Binary sequence
b=2*d-1;
o = b(1:2:end); % Separating odd bits
e = b(2:2:end); % Separating even bits
for j=1:5
qpskmod= e(j).*inPhaseOsc+o(j).*quadPhaseOsc;
qpskmod;
received=qpskmod;
end
% plot the eye pattern diagram of the received signal
subplot(2,1,1)
eyescat(received,0.5,Fs)
axis([0 1.5 -1.5 1.5])
Eye diagram for qpsk is as follows: