Viterbi algorith for trellis traceback
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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 Center 和 File Exchange 中查找有关 Error Detection and Correction 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!