Question: Write a function that will accept a matrix and return a matrix. The function should take the passed matrix and using Gauss Elimination put zeros
Write a function that will accept a matrix and return a matrix. The function should take the passed matrix and using Gauss Elimination put zeros in the first column of the matrix. The first step is to put the row with the largest absolute value in the first row by swapping using two functions you wrote in a previous homework (see below). Then calculate the factor necessary to multiply the first row by so that when it is added to the second row, the element in row 2 column 1 becomes zero. Use your linear combination function to accomplish this task. Then move down to the next row. Keep looping through the rows until all the elements in column 1, except row 1, are zero.
For example, if the matrix
[ 1 -11 0 3 9 -2 -6 5 4 3 5 7 5 0 4 -3 ]
is passed to the function, the function would return
[-11 0 0 0 -2 8.82 -6 4.45 3 4.27 5 7.82 0 5 4 -3 ]
The functions nessesary for this problem are:
a MATLAB function that takes a matrix, a row number and a scalar as arguments and multiplies each element of the row of the matrix by the scalar returning the updated matrix.
a MATLAB function that takes a matrix, two row numbers and a scalar as arguments and returns a matrix with a linear combination of the rows. For example, if the rows passed to the function were i and j and the scalar was , each element of row j would become aik + ajk , where k represents columns 1 through the number of columns in the matrix.
a MATLAB function that takes a matrix, a row number and a column number. Beginning with the row number passed to the function, scan down the column passed to the function and return the row number that contains the largest absolute value in the column.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
