Quadrature Phase Shift Keying:
clc
clear all;
close all;
N=20;
X=randint(1,N);
L=100;
l=(N/2*L*0.01)-0.01
i=1;
for t=0:0.01:1
I(i)=cos(2*pi*t);
i=i+1;
end
i=1;
for t=0:0.01:1
Q(i)=sin(2*pi*t);
i=i+1;
end
for i=1:N/2
if X((i-1)*2+1)==1
for j=((i-1)*L+1):(i*L)
y(j)=1;
QMI(j)=y(j)*I(j);
end
else
for j=((i-1)*L+1):(i*L)
y(j)=-1;
QMI(j)=y(j)*I(j);
end
end
k=((i-1)*2)+2;
if X(k)==1
for j=((i-1)*L+1):(i*L)
y(j)=1;
QMQ(j)=y(j)*Q(j);
end
else
for j=((i-1)*L+1):(i*L)
y(j)=-1;
QMQ(j)=y(j)*Q(j);
end
end
end
for i=1:(N/2*L)
QP(i)=QMI(i)+QMQ(i);
end
for i=1:(N/2*L)
re1(i)=QP(i)*I(i);
reQ(i)=QP(i)*Q(i);
end
k=1;
for i=1:N/2
rI=0;
rQ=0;
for j=((i-1)*L+1):(i*L)
rI=rI+re(j);
rQ=rQ+reQ(j);
end
if rI>=0
real(i)=1;
else
real(i)=0;
end
if rQ>=0
imag(i)=1;
else
imag(i)=0;
end
det(k)=real(i);
det(k+1)=imag(i);
k=k+2;
end
X
Det
0 comments:
Post a Comment