QAM problem?

echo on
K=10;N=2*K;T=100;
a=rand(1,36);
a=sign(a-0.5);
b=reshape(a,9,4);
% Generate the 16QAM points
XXX=2*b(:,1)+b(:,2)+1j*(2*b(:,3)+b(:,4));
XX=XXX';
X=[0 XX 0 conj(XX(9:-1:1))];
xt=zeros(1,101);
for t=0:100
for k=0:N-1
xt(1,t+1)=xt(1,t+1)+1/sqrt(N)*X(k+1)*exp(1j*2*pi*k*t/T);
echo off
end
end
echo on
xn=zeros(1,N);
for n=0:N-1
for k=0:N-1
xn(n+1)=xn(n+1)+1/sqrt(N)*X(k+1)*exp(1j*2*pi*n*k/N);
echo off
end
end
echo on
pause % press any key to see a plot of x(t)
plot([0:100],abs(xt))
% Check the difference between xn and samples of x(t)
for n=0:N-1
d(n+1)=xt(T/N*n+1)-xn(1+n);
echo off
end
echo on
e=norm(d);
Y=zeros(1,10);
for k=1:9
for n=0:N-1
Y(1,k+1)=Y(1,k+1)+1/sqrt(N)*xn(n+1)*exp(-1j*2*pi*k*n/N);
echo off
end
end
echo on
dd=Y(1:10)-X(1:10);
ee=norm(dd);
I have problem with code on line 30
??? Warning: File: d.m Line: 30 Column: 1
The variable "d" is also the name of this script.
This is illegal, because it will be the name of a script and a variable
in any context from which the script is called.
Error: The previous warning is being treated as an error.
How can I fix it?

 Respuesta aceptada

Walter Roberson
Walter Roberson el 16 de Mzo. de 2011

1 voto

Rename the file, or rename the variable "d" to something else.

3 comentarios

Walter Roberson
Walter Roberson el 25 de Abr. de 2011
Yes. You need to change the line
XXX=2*b(:,1)+b(:,2)+1j*(2*b(:,3)+b(:,4));
It is generating 2 bits of real number and 2 bits of imaginary number, for a total of 4 bits, which is 16 possible values. You need to change it so that it generates a total of 3 bits, which would be 8 possible values. The "circular" might perhaps be a clue: it should possibly put you in mind of the 8 roots of 1, which are
[1, (1/2)*2^(1/2) + ((1/2)*I)*2^(1/2), I, -(1/2)*2^(1/2) + ((1/2)*I)*2^(1/2), -1, -(1/2)*2^(1/2) - ((1/2)*I)*2^(1/2), -I, (1/2)*2^(1/2) - ((1/2)*I)*2^(1/2)]
Walter Roberson
Walter Roberson el 25 de Abr. de 2011
j is not a function. Change your j(1+sqrt(3)) to 1j*(1+sqrt(3))
I suspect your jo (jay lower-case-oh) should be 0j (zero jay)
Walter Roberson
Walter Roberson el 25 de Abr. de 2011
Change the 9 to a 5.
Further changes might be necessary in the program; I do not know enough about the technique to follow the logic of the program.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Preguntada:

Ali
el 16 de Mzo. de 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by