The code is wrong in the innermost loop. I believe it should be:
for ii=1:4
if H(ii,j)==1 && i~=ii
mul=mul*tanh(A(ii,j)/2);
end
end
You also have a missing ‘end’ for the outermost loop.
There seems no point in doing the repmat. You could use
since A(ii,j) is the same for all ii.
Best Answer