Question: Write a MATLAB live script that will compute the Reduced Row Echelon Form (RREF) of any matrix A using only basic programming commands such as
Write a MATLAB live script that will compute the Reduced Row Echelon Form (RREF) of any matrix A using only basic programming commands such as for loops, while loops, if then, if then else, etc. The first line of the script should be to define a matrix A and your script should finish with the matrix R being the RREF of A.
I will be testing your script using the following type of matrices:
- A 3x4 matrix that represents a system of linear equations with a unique solution such as A=[3 2 5 1; 8 -3 -7 10; 4 5 -2 6].
- A 3x5 matrix which has all zeros in its second row.
- A 2x4 matrix.
- A 5x4 matrix with 0 in the upper left-hand corner.
After the script runs, it should be the case that R= rref(A). You should check to see if your script is working correctly by using MATLABs rref function in a MATLAB command line. Submit your live script file through Dropbox in D2L using the file format FirstnameLastname2.mlx. The assignment is worth 100 homework points.
Tips for starting: Use the variables m and n for the number of rows and columns in A respectively and find those values using MATLABs size function. Let i and j be the row and column location of a potential pivot position and use a while loop that continues while i<=m and j<=n. Initialize i and j as i=1 and j=1 and increment them using i=i+1 or j=j+1 when appropriate. The use of a break statement in a loop may be useful.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
