Question
Given an nxn matrix (A) and nx1 right-hand side b, write a function [function Aa = gaussq (A,b,q)] in Matlab that carries out q iterations
Given an nxn matrix (A) and nx1 right-hand side b, write a function [function Aa = gaussq (A,b,q)] in Matlab that carries out q iterations of the Gauss elimination outer loop (without pivoting), where q is an integer between 1 and n, and returns the resulting augmented matrix with all below-diagonal elements transformed to zero in the left-most q columns.
Example: if A =
1 1 1 0
-1 1 0 1
-1 2 1 1
0 0 1 2
and b =
1
1
2
3
then gaussq (A, b, 1) should return
1 1 1 0 1
0 2 1 1 2
0 3 2 1 3
0 0 1 2 3
gaussq (A, b, 2) should return
1 1 1 0 1
0 2 1 1 2
0 0 0.5 -0.5 0
0 0 1 2 3
gaussq (A, b, 3) and gaussq (A, b, 4) should both return
1 1 1 0 1
0 2 1 1 2
0 0 0.5 -0.5 0
0 0 0 3 3
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