N=24;
bit_sequence=rand(1,N)>0.5;
temp= exp(j*2*pi.*([1:8])./8);
%transformbit = [0 0 0];
psk8_sequence = ones(1,N/3);
for k=1:N/3
transformbit = bit_sequence(3*k-2:3*k);
if transformbit== [0 0 0]
psk8_sequence(k) = temp(1);
end
if transformbit== [0 0 1]
psk8_sequence(k) = temp(2);
end
if transformbit== [0 1 0]
psk8_sequence(k) = temp(3);
end
if transformbit== [0 1 1]
psk8_sequence(k) = temp(4);
end
if transformbit== [1 0 0]
psk8_sequence(k) = temp(5);
end
if transformbit== [1 0 1]
psk8_sequence(k) = temp(6);
end
if transformbit== [1 1 0]
psk8_sequence(k) = temp(7);
end
if transformbit== [1 1 1]
psk8_sequence(k) = temp(8);
end
end