Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 > f = @(th,c,k) c(1) * cos( k(1)*th) + c(2) * sin( k(2) *th ); The following functions are to be plotted for 0 (0,21] using MATLAB: Graph 1: x(0) = 3 cos(0) + sin(0) on the 0-x plane; Graph 2: y(0) = 2 cos(20) + 4 sin(30) on the 0-x plane; Graph 3:7(0) = (x(0), y(0)) on the 2-y plane. Suppose that th has been already created in MATLAB by >> th = linspace(0, 2*pi, 361); Match each of the three graphs above with the code that correctly generates it. Code A: plot(th, f(th,3,1,1,1)) Code B: plot(th, f(th, [3 1],[1 1])) Code C: plot(th, f(th, -2,4,2,3) Code D: plot(th, f(th, [-2 4],[2 3])) Code E: plot(f(th,[3 1],[1 1]), f(th, [-2 4],[2 3])) Code F: plot(th, f(th, [3 1],[1 1]), th, f(th, [-2 4],[2 3])) Graph 1 [Choose ] Graph 2 [Choose ] Graph 3 [Choose ]
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started