Question: Let A be an (m x n) matrix containing certain data. The following code calculates the weighted sum of all elements in each column and
Let A be an (m x n) matrix containing certain data. The following code calculates the weighted sum of all elements in each column and returns the result as a (1 xn) row vector t. (The weights used are stored in a (1 x m) row vector w.) [m, n] = size(A); zeros (1, n); for i=1:m tot + w(1)*Ai,:); end Mathematically, the weighted sum of the j th column is computed by t; = 1 W; Ai,jo for 1 sj
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
