QPSK modulation/SER
6 views (last 30 days)
Show older comments
I have project to finish, which is QPSK modulator/demodulator simulation with matlab. At first I tried using gray coding, but the decided to do using I/Q components, for some reasons. I think modulation part is successful, but when I got to the demodulation part, where I need to find false bits...for my SER. I just can't get desired results. What I tried, is correlating received signals (carry for 1 and carry for 0) and then comparing them both, but this gave me 0 errors... Just look at the part that's correlating signal and tell me if you have any ideas. ty
clc;clear all;close all;
%1 Uzduotis
bit_stream = randi([0 1],[1 10^4]);
Fc = 10^6;
T_bit = 5*10^(-6);
F_disc = 10^7;
n = 0:(F_disc*T_bit)-1;
t = n/F_disc;
%waveforms for odd bits
I = cos(2*pi*Fc*t);
%I1 = cos(2*pi*Fc*t+pi);
%waveforms for even bits
Q = sin(2*pi*Fc*t);
%Q1 = sin(2*pi*Fc*t+pi);
i = 1;
j = 1;
odd_bits = zeros(1,length(bit_stream)/2);
even_bits = zeros(1,length(bit_stream)/2);
while (i<length(bit_stream))
odd_bits(j) = bit_stream(i);
even_bits(j) = bit_stream(i+1);
i = i+2;
j = j+1;
end
temp_odd = odd_bits;
temp_even = even_bits;
for i = 1:length(odd_bits)
if odd_bits(i)==0
odd_bits(i)=-1;
end
if even_bits(i)==0
even_bits(i)=-1;
end
end
qI = [];
qQ = [];
QPSK_signal = [];
for i = 1:length(odd_bits)
qI =[qI odd_bits(i)*I];
end
for i = 1:length(even_bits);
qQ = [qQ even_bits(i)*Q];
end
QPSK_signal = qI+qQ;
figure(1);
subplot(3,1,1);
plot(I);
title('cos wave');
grid on;
subplot(3,1,2);
plot(Q);
title('sin wave');
grid on;
subplot(3,1,3);
stem(bit_stream);
title('Moduliuojamas bitu srautas');
axis([0 200 -0.5 1.5]);
figure(2)
subplot(3,1,1);
plot(qI);
axis([0 200 -1.5 1.5]);
title('Odd bits');
grid on;
subplot(3,1,2);
plot(qQ);
axis([0 200 -1.5 1.5]);
title('Even bits');
grid on;
subplot(3,1,3);
plot(QPSK_signal,'LineWidth',2);
axis([0 200 -1.5 1.5]);
title('QPSK signal');
grid on;
%3 Uzduotis
%figure(3)
%periodogram(QPSK_signal,window,'onesided',10e6,F_disc);
%4 Uzduotis
h_max = 30;
%h = 3;
counth = 0;
j = 1;
s = 1;
rec_sigI = [];
reg_sigI0 = [];
for h = 1:0.1:h_max
count = 0;
for i = 1:length(odd_bits)
Noise = randn(1,length(qI));
rec_sig = h*qI + Noise;
%rec_sigI0 = h*(-I)+Noise;
K1 = sum(rec_sig(1:length(I)).*I);
K2 = sum(rec_sig(1:length(I)).*(-I));
if K2 > K1
count = count+1;
end
end
counth(j) = count;
j = j+1;
end
ser = counth/10000;
figure();
loglog(ser);
grid on;
0 Comments
Answers (0)
See Also
Categories
Find more on QPSK in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!