You are trying to store a 2 by 2 array of m values in to a single location in the numeric array M. That is not going to fit.
If, for some reason, you need the 2 x 2 block to be accessible through a single index, then change the line to
M{j} = [m(j,1),m(j,2);m(j,3),m(j,4)];
and change the lines
d=1;
for j=1:n
Mf(j)=M((2*j)-1)*M(2*j)*d;
d=Mf(j);
end
to
d=ones(2,2);
for j=1:n
Mf{j}=M{(2*j)-1}*M{2*j}*d;
d=Mf{j};
end
However, keep in mind that the "*" operation between the two "M" accesses, and the "*" between the second "M" and the "d", are going to be matrix multiplications. If you want element-by-element multiplication, use ".*" instead of "*" .
Best Answer