Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The command rref ( is ) returns the reduced row echelon form of a matrix A 1 The command , pivcols ] = rref (
The command rref is returns the reduced row echelon form of a matrix
The command pivcolsrref A returns and pivcols, where matrix rref and pivcols indicates pivot
columns of
The command rank returns the rank of a matrix
You also need two fle functions rankcomp given and Lssolut ion template only In these functions, you need to know:
ifelse statement
If an expression is true, it executes statements block. Otherwise, it executes statements block.
ifelseif statement
If expression is true, it executes statements block. If not, check expression If expression is true, it executes statements block.
If not, execute statements block.
if expression
statements block
elseif expression
statements block
eise
statements block
following in the Live Editor.
Display the reduced row echelon form and the pivot columns of the augmented matrix
Write a report to explain if there is a solution of based on rref
B Use the RouchCapelli Theorem by comparing the rank and rank:
Call the function rankcomp and determine if is consistent.
Compare the result with Part You should have the same conclusion.
Note: rankcomp gives you a new command to compare if rankrank When you need to use the command, read the
the two input matrices.
C Open the template Lssolut ion. Use the RouchCapelli Theorem as a guide and code the function using an ifelseif statement ido
not use nested ifelse statements When Lssolut ion is called it should return the correct system type based on whether
has a solution and how many. The function should outputreturnset systerntype to:
inc ir the system is inconsistent and has no solution, or
conwithonesol if the system is consistent and has a unique solution, or
conwithinfsols if the system is consistent and has infitely many solutions.
Note: You should include three input arguments for Lssolut ion, where is the number of variables in the system of
equations. Code I have so far: Part A Points
Ab A b; WRITE COMMAND BEFORE SEMICOLON
COMMENTS FOR B AND pivcols
B pivotcol rrefAb;
dispReduced Row Echelon Form RREF:;
dispB;
dispPivot Columns:;
disppivotcol;
EXPLAIN WHY SYSTEM IS INCONSISTENT
Part B Points
rankA rankA;
rankAb rankAb;
rankcomprankA rankAb;
if rankA rankAb
dispThe system Ax b is consistent.;
if rankA n
dispThe system has a unique solution.;
else
dispThe system has infinitely many solutions.;
end
else
dispThe system Ax b is inconsistent.;
end
STATE THEOREM
APPLYUSE THEOREM & COMPARE TO RESULT FROM PART A
Part C Points
LSsolutionn A Ab;
m n sizeE; UNCOMMENT LINE AND COMPLETE
solutiontype NaN;
end I am getting an error that there is no variable n as it is called in the function. How would I implement n Here is the function I wrote. LSsolutionn A AbPURPOSE OF FUNCTION
n number of variables
A coefficient matrix
Ab augmented matrix A b
inc "Inconsistent";
conwithonesol "Consistent with One Solution";
conwithinfsols "Consistent with Infinite Solutions";
rankA rankA;
rankAb rankAb;
Add your code below
if rankA rankAb
systemtype inc;
elseif rankA rankAb
if rankA n
systemtype conwithonesol;
else
systemtype conwithinfsols;
end I need help with the parts under the comments and anything that says NaN or to explain something. In essence, if it has a comment then I need help.
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