Question: Question 6 7 pts Let A be an (m x n) matrix containing certain data. The following code calculates the weighted sum of all elements


Question 6 7 pts 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 x n) row vector t. (The weights used are stored in a (1 x m) row vector w.) [m, n] = size (A); t = zeros (1, n); for i = 1:m t = t + w(i) *A(i,:); end Mathematically, the weighted sum of the j th column is computed by t; = 27-1 W; Ai,jfor 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
