MATLAB: Problem in code for 16 qam

16qam

Hi i wrote a code to seperate a binary signal to groups of 4 bits and maping them to a complex number,but didnt work and i cant find why. Please help!
clear all
close all
clc
a = [1 1 1 1 0 0 0 0 1 1 1 1]
k=1
for i=1:4:16
if a(i:i+3)=[0000]
b(k)=1-3j
else a(i:i+3)=[1111]
b(k)=3+3j
end
k=k+1
end

Best Answer

add spaces in binary vectors:
a(i:i+3)=[0 0 0 0]
...
a(i:i+3)=[1 1 1 1]