A student produced the following script, egnsolver. m, in response to a programm
ID: 3840784 • Letter: A
Question
A student produced the following script, egnsolver. m, in response to a programming assignment to create a script that would solve a set of linear equations given an augmented coefficient matrix file. 1. t script to solve linear set of equations 3. i requires augmented coefficient matrix file header 8. get augmented coefficient decompose rhs 1 to coefficient matrix Amat, and right hand side disp natrix file name fname input ('Augmented coefficient 10 load (fname) Nrow Ncol) size (fname) Amat augmat 1 Nrow) 13 rhs augmat Ncol) 16 solve system soln Amat/rhs. 18 19. display results disp disp (The solution vector is) disp (soln) However, the following messages appeared when the student attempted to run the script using a properly configured augmented coefficient matrix .called test.dat, as a test case. Your job is to find the offending line of code and (2) show a fix to the error in the spaces provided below the message (a) Error: File C: eqnsolver Line 5 Column 13 Expected a variable, function or constant, foundExplanation / Answer
a.(1) Offending line of code, Line #: 5
(2) Correction: header
b.(1) Offending line of code, Line #: 10
(2) Correction: fname = input('Augmented coefficient matrix file name? ==> ','s');
c.(1) Offending line of code, Line #: 12
(2) Correction: [Nrow, Ncol] = size(augmat);
d.(1) Offending line of code, Line #: 17
(2) Correction: soln = Amat hs; soln = inv(Amat)*rhs; soln = (Amat^(-1))*rhs;
e.(1) Offending line of code, Line #: 21
(2) Correction: disp('The solution vector is')
f.script to solve linear set of equations A*x = b
requires augmented coefficient matrix file
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.