From: Vldim Vletsis on 27 May 2010 14:04 my code for qpsk is the following: function[st,t]=qpsk(R,fs,fc,d); %EightPSK 8-ary phase shift keying %[st,t]= EightPSK (R,fs,fc,d) outputs samples of 8PSK signal. %R....bit rate of inpute data. %fs....sample rate %fc....carrier frequency %d....vector of input data %st....vector of output data %t....vector of output time stamps % % t=[0:1/fs:(length(d)/R)-(1/fs)]; %vector of time stamps cospart=[]; sinpart=[]; modforc=[]; modfors=[]; c=[]; s=[]; cc=[]; ss=[]; for k=1:2:length(d); if d(k)==1 & d(k+1)==1 cospart(k)=cos(pi/4); cospart(k+1)=cos(pi/4); sinpart(k)=sin(pi/4); sinpart(k+1)=sin(pi/4); elseif d(k)==0 & d(k+1)==1 cospart(k)=cos(3*pi/4); cospart(k+1)=cos(3*pi/4); sinpart(k)=sin(3*pi/4); sinpart(k+1)=sin(3*pi/4); elseif d(k)==0 & d(k+1)==0 cospart(k)=cos(5*pi/4); cospart(k+1)=cos(5*pi/4); sinpart(k)=sin(5*pi/4); sinpart(k+1)=sin(5*pi/4); elseif d(k)==1 & d(k+1)==0 cospart(k)=cos(7*pi/4); cospart(k+1)=cos(7*pi/4); sinpart(k)=sin(7*pi/4); sinpart(k+1)=sin(7*pi/4); end end tmp=ones(length(d),(length(t)/length(d))); for k=1:length(d); modforc=[modforc cospart(k)*tmp(k,:)]; modfors=[modfors sinpart(k)*tmp(k,:)]; end c=(cos(2*pi*fc*t)); s=(sin(2*pi*fc*t)); cc=[cc c]; ss=[ss -s]; st=((modforc.*cc)+(modfors.*ss)); end do you have any idea for o-qpsk? :)
|
Pages: 1 Prev: integer programming with matlab Next: how can I do integer optimization with GA in Matlab? |