from
QPSK modulation
by Ganesh AS
gives u qpsk of even length message signals and displays the plot
|
| quad.m |
f=1000000;
len=length(b);
t=0:1/999:1;
qcar=[];icar=[]; %initialize in-phase and quadrature carriers
ic=[];qc=[]; %initialize in-phase and quadrature components;
for n=1:2:len
if b(n)==0 & b(n+1)==0;
temp=-1/sqrt(2)*ones(1,1000);
temp1=-1/sqrt(2)*ones(1,1000);
elseif b(n)==0 & b(n+1)==1;
temp=-1/sqrt(2)*ones(1,1000);
temp1=1/sqrt(2)*ones(1,1000);
elseif b(n)==1 & b(n+1)==0;
temp=1/sqrt(2)*ones(1,1000);
temp1=-1/sqrt(2)*ones(1,1000);
elseif b(n)==1 & b(n+1)==1;
temp=1/sqrt(2)*ones(1,1000);
temp1=1/sqrt(2)*ones(1,1000);
end
i=cos(2*pi*f*t);
q=sin(2*pi*f*t);
ic=[ic temp];
qc=[qc temp1];
icar=[icar i];
qcar=[qcar q];
end
qpsk=ic.*icar+qc.*qcar
plot(qpsk);
|
|
Contact us at files@mathworks.com