i advise you :
1. You must precise fc (carrier frequency), fs (sampling frequency) and B (baud rate). Then, N=fs/B will be the number of sample in one symbol of period T=1/B;
2. Time vector t=0:1/fs
N-1)/fs; % time for one symbol
3. M=4; % 4 state for QPSK modulation
k=log2(M)=2; % 2 bits for ones symbol
data=randint(1,k*Nsym,[0 1]); % generate random binary vector [0 1 1 0 1 0 1 1 0 0 .... ]
qpskdata=bi2de(reshape(data,Nsym,k),'left-msb'); % Convert the bits in data into k-bit symbols [1 2 2 3 0 ...], 00=0 / 01=1 / 10=2 / 11=3
4. you must code data in phase. you have choice phi(i)=2*pi*qpskdata(i)/M [0,pi/2,pi,3pi/2] or phi(i)=(2*qpskdata(i)+1)*pi/M [pi/4,3pi/4,5pi/4,7pi/4]
your vector will be like that [pi/2 pi pi 3pi/2 0 ...] : QPSK constellation
finely : s(i)=A*sin(2*pi*fc*t+phi(i))
y= []
for i=1:Nsym
y=[y A*sin(2*pi*fc*t+phi(i))]
end