Viterbi algorith for trellis traceback

조회 수: 1 (최근 30일)
Mohamad Khalil
Mohamad Khalil 2021년 1월 17일
댓글: Mohamad Khalil 2021년 1월 22일
Hello,
i am trying to simulate GSM and i have s function called FCN_VITERBI that generate table for trellis, metrics and metric differences and then trys to find the last state and traceback the trellis based on viterbi algorithm.
At the end i am trying to show the trellis by using the following function:
function [C] = showTrellis(S,bEst,sTrace)
len = 10;
figure(30)
clf
C = [0 1 0; 0 1 0; 0 1 0; 0 1 0;1 0 0; 1 0 0; 1 0 0; 1 0 0];
%plot([1,2],[(1:8)',S(:,1)]','-o');
hold on
for i = 0:len - 2
P = plot([2,1]+i,[(0:7)',S(:,2+i)-1]','-o','Linewidth',3); %the error position
%plot([2,1]+i,[(0:7)',S(:,2+i)-1]','-o','Linewidth',3);
for j = 1:8
P(j).Color = C(j,:);
end
text(i + 1.4,-.5,num2str(bEst(i+1)),'FontSize',14);
end
plot(sTrace(1:len)-1,'--k','Linewidth',3);
title('Trellis Diagram');
end
but i get the following error:
Error using horzcat
Dimensions of arrays being concatenated are not consistent.
Error in showTrellis (line 10)
P = plot([2,1]+i,[(0:7)',S(:,2+i)-1]','-o','Linewidth',3);
%some infos
length(S) = 62
length(h) = 6
length(y) = 66
L = 5
length( r ) = 64
length(ini_S) = 1
tail_R = [111]
can someone please help?
Thanks

답변 (1개)

Gaurav Garg
Gaurav Garg 2021년 1월 20일
Hi Mohamad,
You should try printing individual arrays [2,1]+i and [(0:7)',S(:,2+i)-1]' and ensure that the array sizes are same.

카테고리

Help CenterFile Exchange에서 Error Detection and Correction에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by