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

Matlab Question: Start a new script function : name the function sys_solver 1- a

ID: 2258877 • Letter: M

Question

Matlab Question:

Start a new script function: name the function sys_solver

1- a ccept two input arrays: a 3 by 2 matrix A, and a 3 by 1 vector b,

2- finds the solution of the linear system Ax=b , using matrix left division, and produces a single out put x.

3- Note that your code MUST issue an error message if any row or column dimensions of A or b are not as mentioned above.

(Hint: You may wish to write an if statement and use the error command in MATLAB to issue your error message.

you can use the logical or command in MATLAB to check the row and column dimenstions for this error message.)

4- Note that youe code MUST disply your first name and family name AFTER the out put x is computed. (Hint: you can use the display command in NATLAB)

Explanation / Answer

Matlab code

function x=sys_solver(A,b)
A=input('A');
b=input('b');
[m,n]=size(A)
[m1,n1]=size(b)
if (m==3)&&(n==2)&&(m1==3)&&(n1==1)
x=(A'*A)A'*b;
display('my first name and my family name');
else
x='error';
display('err');
end