MATLAB: Need help in coding this summation, please.

Hi,
Can anybody help me with coding this summation into matlab, please:
where J is (3×6), A is (6×6) and Phi is (3x3x9).
I've tried with this code:
 % for ii=1:hor    for mm=1:ii        G(:,:,ii)=sum(kron(J*A'^(ii-mm),Phi(:,:,mm)),3);    end   end %
but it doesn't seem to work, as I get incorrect results. I think the mistake is in the sum function, but I don't know other way of coding the summation (cumsum function doesn't work either).
I'd really appreciate some help here, as I'm completely stuck.
best,