Problem with Maximum Likehood Detector's (for MIMO systems) Code!
5 views (last 30 days)
Show older comments
Hi everyone, I wrote a code of a ML Detector for MIMO systems:
function sML= MLDet (x,H,C,N,M)
SNR=rand*40-10;
j=sqrt(-1);
iModulation=randi(3) %1=BPSK, 2=QPSK , 3=16QAM
mymodalalphabet = {[1,-1,1,-1], [1+j, 1-j, -1+j, -1-j], [1+j, 1-j, -1+j, -1-j, 3+j, 3-j, -3+j, -3-j,1+3j, 1-3j, -1+3j, -1-3j, 3+3j, 3-3j, -3+3j, -3-3j]}
symbset=mymodalalphabet{iModulation}
M= numel(symbset)
Eta= sqrt((1/SNR)/2)*(randn(4,1)+1j*randn(4,1)) ; % Eta= noise % sigma^2= 1/SNR
y= symbset(randi(3,4,1)); y=y'
H=randn(4,4)+j*randn(4,4);
x=H*y+Eta ;
v=[1/SNR 1/SNR 1/SNR 1/SNR];
C=diag (v);
mini= inf;
N= 4; % N=Number of the symbols
for i=1:2^N
for j= 1:N
k= N-j+1;
a=i-1;
s(j)= a/2^(M*k);
a= a-s(j)*2^(M*k);
end
end
s= qammod(s,M);
s=s'
f=(x-H*s)'*inv(C)*(x-H*s);
if f< mini
mini=f;
sML=s;
end
sML
end
So if I run this programm , matlab says: ''Error using qammod (line 38) Elements of input X must be integers in the range [0, M-1].
Error in MLDet (line 40) s= qammod(s,M);''
I just tried to convert the vector s which is double according to Matlab to integers with s= int8(s), but it didn't work either. Because it gave me the error message: ''Error using *
Inner matrix dimensions must agree.
Error in MLDet (line 43) f=(x-H*s)'*inv(C)*(x-H*s);'' But i checked and s, x H etc. do have the right dimension. Not matter if I use s or s', this error message always comes.
So can you see where the actual problem is? Would be great if you can help me! Thank you. Ruifei
3 Comments
Yu Jiang
on 12 Aug 2014
Can you provide a minimum code that can generate the input arguments and can be used to test the function? That would be really helpful.
-Yu
Answers (0)
See Also
Categories
Find more on QAM in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!