Need Help in 3x3 QPSK for Likelihood

edited August 2010 in Science & Tech
this code is work with 2x2 QPSK but not working with 3x3 QPSK of Maximum likelihood and dont know how to fix it


this is the code of 3x3 for Likelihood


function [Received_Symbols] = ML_Decode_3_3(Y,H,Symbols)
 
N=3;
 
nSymbols = length(Symbols);
 
Symbol_Vectors = [ kron( ones(1,nSymbols) , Symbols ) ; kron( Symbols , ones(1,nSymbols) ) ];
 
YMHS = kron(Y,ones(1,nSymbols^N)) - H*Symbol_Vectors;
 
Distance = sum( YMHS.*conj(YMHS) , 1 );
 
[ C , Index] = min(Distance);
 
Received_Symbols = Symbol_Vectors(:,Index);
 
 
and then adding the test code to it 
 
Modulation = 'QPSK'
 
Decode_Method = 'Maximum Likelihood'
 
switch Modulation
 
case {'QPSK'}
 
Symbols = [ 1+j 1-j -1+j -1-j ]';
 
end
 
Symbols = Symbols.'

SNR_Array = [0.1 0.3 0.7 1.2 2.5 5 6.2 10 15.4 22 45 75.7 100 200];
 
nSNR = length(SNR_Array);
 
Ntest = 20;
 
N = 3;
 
for iSNR = 1 : nSNR
 
SNR = SNR_Array(iSNR);
 
Nerror = 0;
 
for i = 1:Ntest
 
H = randn(N,N) + j*randn(N,N);
 
X = Symbols( ceil( 4*rand(N,1) ) )';
 
Noise = (randn(N,1) + j*randn(N,1))/sqrt(2)/sqrt(SNR);
 
Y = H*X + Noise;
 
switch Decode_Method
 
case {'Maximum Likelihood'}
 
X_Decode = ML_Decode_3_3(Y,H,Symbols);
 
Nerror = Nerror + length( find( X ~= X_Decode) );
 
end
end

Symbol_Error_Rate(iSNR) = Nerror/Ntest/N;
 
end
figure(1)
loglog(SNR_Array, Symbol_Error_Rate,'b')
xlabel('SNR')
ylabel('Symbol Error Ratio')
title('Symbol Error Ratio')

error is :

??? Error using ==> mtimes
Inner matrix dimensions must agree

Error in ==> ML_3_3 at 11
YMHS = kron(Y,ones(1,nSymbols^N)) - H*Symbol_Vectors;

Error in ==> test_ML_3_3 a 36
X_Decode = ML_Decode_3_3(Y,H,Symbols);


thanks

Comments

  • shwaipshwaip bluffin' with my muffin Icrontian
    edited August 2010
    to do a matrix multiply A*B (or in your case, H*Symbol_Vectors), the inner dimensions of A and B must match. If A is MxN, then B must be NxP. (M and P can be any size).
Sign In or Register to comment.