function softbit=qam16demod(symbol)
a=sqrt(10);
symlength=length(symbol);
for ii=1:symlength;
if real(symbol(ii))>=0
if imag(symbol(ii))>=0
if real(symbol(ii))>=2*a
if imag(symbol(ii))>=2*a
temp(ii*4)=0;
temp(ii*4-1)==0;
temp(ii*4-2)==0;
temp(ii*4-3)==0;
else
temp(ii*4)=0;
temp(ii*4-1)==1;
temp(ii*4-2)==0;
temp(ii*4-3)==0;
end
else
if imag(symbol(ii))>=2*a
temp(ii*4)=0;
temp(ii*4-1)==0;
temp(ii*4-2)==0;
temp(ii*4-3)==1;
else
temp(ii*4)=0;
temp(ii*4-1)==1;
temp(ii*4-2)==0;
temp(ii*4-3)==1;
end
end
else
if real(symbol(ii))>=2*a
if imag(symbol(ii))>=-2*a
temp(ii*4)=1;
temp(ii*4-1)==1;
temp(ii*4-2)==0;
temp(ii*4-3)==0;
else
temp(ii*4)=1;
temp(ii*4-1)==0;
temp(ii*4-2)==0;
temp(ii*4-3)==0;
end
else
if imag(symbol(ii))>=-2*a
temp(ii*4)=1;
temp(ii*4-1)==1;
temp(ii*4-2)==0;
temp(ii*4-3)==1;
else
temp(ii*4)=1;
temp(ii*4-1)==0;
temp(ii*4-2)==0;
temp(ii*4-3)==1;
end
end
end
else
if imag(symbol(ii))>=0
if real(symbol(ii))>=-2*a
if imag(symbol(ii))>=2*a
temp(ii*4)=0;
temp(ii*4-1)==0;
temp(ii*4-2)==1;
temp(ii*4-3)==1;
else
temp(ii*4)=0;
temp(ii*4-1)==1;
temp(ii*4-2)==1;
temp(ii*4-3)==1;
end
else
if imag(symbol(ii))>=2*a
temp(ii*4)=0;
temp(ii*4-1)==0;
temp(ii*4-2)==1;
temp(ii*4-3)==0;
else
temp(ii*4)=0;
temp(ii*4-1)==1;
temp(ii*4-2)==1;
temp(ii*4-3)==0;
end
end
else
if real(symbol(ii))>=-2*a
if imag(symbol(ii))>=-2*a
temp(ii*4)=1;
temp(ii*4-1)==1;
temp(ii*4-2)==1;
temp(ii*4-3)==1;
else
temp(ii*4)=1;
temp(ii*4-1)==0;
temp(ii*4-2)==1;
temp(ii*4-3)==1;
end
else
if imag(symbol(ii))>=-2*a
temp(ii*4)=1;
temp(ii*4-1)==1;
temp(ii*4-2)==1;
temp(ii*4-3)==0;
else
temp(ii*4)=1;
temp(ii*4-1)==0;
temp(ii*4-2)==1;
temp(ii*4-3)==0;
end
end
end
end
end
softbit=temp;