how to generate qpsk signal
5 views (last 30 days)
Show older comments
I am trying to generate a qpsk signal. I have code for the generation of a bpsk signal and I want a similar one for qpsk. What can I change in my code below to make the results that of qpsk. Below is the code for bpsk;
clear;
clc;
close all;
N=1024;
rN=rand(1,N);
rBinary=round(rN);
Fc=2;
Fs=4;
nCycles=1;
Tb=nCycles/Fc;
t=0:1/Fs:(nCycles-1/Fs);
xC=cos(2*pi*t);
A=1;
Eb=(A^2*Tb)/2;
Eb_N0dB=0:2:14;
Eb_N0=10.^(Eb_N0dB/10);
nVar=(Eb)./Eb_N0;
bitStream = [];
carrierSignal = [];
i = 1;
while(i<=N)
if(rBinary(i))
bitStream = [bitStream ones(1,length(xC))];
else
bitStream = [bitStream zeros(1,length(xC))];
end
carrierSignal = [carrierSignal A*xC];
i = i+1;
end
bits = 2*(bitStream - 0.5)
bpskSignal = carrierSignal.*bits;
figure(1);
subplot(3,1,1);
plot(bitStream);
title('Digital signal');
xlim([0 300]);ylim=([-0.2 1.2]);
subplot(3,1,2);plot(carrierSignal);
title('Carrier signal')
xlim([0 300]);ylim=([-0.2 1.2]);
subplot(3,1,3);plot(bpskSignal);
title('BPSK');
xlim([0 300]);ylim=([-0.2 1.2]);
subplot(3,1,2);plot(carrierSignal);
end
0 Comments
Answers (1)
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!