Complete the function using Matlab In this exercise, the linSys_2(A, b) function
ID: 2085681 • Letter: C
Question
Complete the function using Matlab
In this exercise, the linSys_2(A, b) function will be used to approximate the solution for a rectangular system of equations. When a system of equations is described in the form Ax = b, it can only be evaluated through x = A^-1b if A is a non-singular square matrix. If a system of equations is overdetermined (more equations than unknowns), a least squares solution can be evaluated using the equation x = (A^TA)^-1 A^T b (this is the vector x that minimizes ||Ax - b||). Function Template: function x = linSys_2(A, b) x = 0: %insert equation for x here. end Submitted file: function x = linSys_2 (A, b) x = 0: %insert equation for x here. endExplanation / Answer
This is straight forward erquation and the code can be written as follows:
function x = linSys_2(A,b)
x = inv(transpose(A)*A)*transpose(A)*b;
end