Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

this exercise, the linSys_2 (A,b) function will be used to approximate the solut

ID: 3710897 • Letter: T

Question

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 b ifA is a non-singular (i.e, invertible) square matrix. If a system of equations is overdetermined (more equations than unknowns), a least squares solution can be evaluated using the equation (ATA)1ATb (this is the vector x that minimises l/Ax-bD Function Template: function x -linSys_ 2(A,b) x : 0; %insert equation for x here end Test Example Given A-[1 2;3 4;5 6] and b [7;8,9], then linSys_2(A,b) should return [-6,6.5 1. Please read through Chapter 9 of the Introduction to Programming in MATLAB document on Blackboard for details on how to solve a matrix transpose, matrix inverse, and multiply matrices. Submitted file: function x = linsys_2(a,b) x-0; %insert equation for x here. end

Explanation / Answer

For a rectanglular system of equations the function used is  linSys_2(A,b)

Given function template is ;

function x =  linSys_2(A,b)

x = 0; % insert equation for x here

end

For the equation x = (ATA)-1ATb the code is given as

function x = linSys_2(A,b)
x = inv(transpose(A)*A)*transpose(A)*b;
end