MATLAB: Can someone please explain this code for me

MATLAB and Simulink Student Suitematrix array

for i=1:ni
for j=1:nj
for k=1:nj
cc(i,j) = cc(i,j)+aa(i,k)*bb(k,j);
end
end
end

Best Answer

It is code for matrix multiplication of two matrices aa (dimensions ni*nj) and bb (dimensions nj*nj). Read here: https://en.wikipedia.org/wiki/Matrix_multiplication. Equivalent MATLAB command is
cc = aa*bb