Hi,
I am looking for an efficient way to 'fill up' a three-dimensional (m by n by o size) matrix M with elements based on a simple rule.
I have a number of matrices of size m X n X 1. I want the matrix M to contain weighted sums of these m X n X 1 size matrices. The weighted sums are obtained by the general formula
M(:,:,i) = f1(A, theta(i)) + f2(B, theta(i)) + f3(C, theta(i)) + ...
where f1, f2, f3, etc… are arbitrary functions and A, B, C, etc… are the m X n X 1 size matrices. theta is a 1 X o size vector containing angles (the functions f1, f2… are trigonometrical functions). The functions f1, f2… apply elementwise operations on A, B,… using a single value of theta, thus their outputs are also m X n X 1.
I can fill the matrix M up by looping through i=1:o and inserting the appropriate level M(:,:,i). However I feel that there must be a vectorized solution that works much faster.
I'd appreciate if you could give me ideas where to look for this functionality.
Thanks a lot,
Paul
Best Answer