I have a matrix d whose dimensions are 2 X 2 X 1000
d(:,:,1)= [ a1 b1
c1 d1]
d(:,:,2)= [ a2 b2
c2 d2]
And I have a array u 1 X 1000
u=[u1 u2 ... u1000] .
I want to create a matrix M where each element of M is equal to an element of the matrix in the matrix d elevated at the correspondent element in U vector.
M = [ a1^u1*a2^u2*...a1000^u1000 b1^u1*b2^u2*...b1000^u1000
c1^u1*c2^u2*...c1000^u1000 d1^u1*d2^u2*...d1000^u1000 ]
And I tried to write this code:
n_length =2
for k=1:length(d)
for i = 1:n_length
for j = 1:n_length
M(i,j)= prod(d(i,j,k)^u(1,k));
end
end
end
But there is something wrong. Although there is no error but the output is not as expected. I think I made a mistake in implementing the equations above. Could anyone help me to combine the d and U by the above method ?