Use Gauss-Jordan elimination to solve the system of simultaneous equations:
2v + 3w -5y + y -z =15
v-3w+4x+y-z=-6
-2v+w-3x+3y+2z=3
3v-w-x+4y=-3
v+4w-2x+y-2z=6
1. Write a MATLAB function (upperTriangle) using the functions to convert a matrix to upper triangular form. Start with row 1, column1. Find the row that has the largest absolute value in the current column (you have a function that will do that). If the row is not your working row, swap rows (you have a function that will do that). Calculate a factor that you can use to form a linear combination with your working row to zero the value in the column below your working row. Use that factor and the linear combination of rows to zero the first column below your working row (you have a function that will do that). Continue down that column until you reach the last row. All the values in your working column below your working row should be zero. Move to the next diagonal position (down 1 row over 1 column) and repeat the process. Continue the process moving down the diagonal until you reach the last row. You matrix should be in upper triangular form.
Your function should be written to handle matrices of any size. Test your function with matrices of different sizes for which you know the solution to ensure that your function works correctly.
Use variable names that relate to their function and include comments that explain your program logic.
Do not use any built-in MATLAB functions except size(), input(), and zeros().
Next update the functionto a function that solves a system of linear equations or calculates the inverse of a matrix by Gauss-Jordan elimination. Your function should accept a matrix as an argument and return a matrix of the same dimension.
Note: Your function should be written to handle matrices of any size. Test your function with matrices of different sizes for which you know the solution to ensure that your function works correctly.
Use variable names that relate to their function and include comments that explain your program logic.
Do not use any built-in MATLAB functions except size(), input(), and zeros().
As example of what is expected from this function consider the following linear system:
3x + 2y + z = 11
2x + 3y +z = 13
x + y + 4z = 12
In this case you should pass into your function the following augmented matrix:
![1424_Matrix.png](https://secure.tutorsglobe.com/CMSImages/1424_Matrix.png)
After performing Gauss-Jordan elimination, your function should return the following reduced system:
![2449_Matrix1.png](https://secure.tutorsglobe.com/CMSImages/2449_Matrix1.png)
from which we can determine that x = 1, y = 3, z = 2.
Furthermore, if you pass a double augmented matrix such as
![578_Matrix2.png](https://secure.tutorsglobe.com/CMSImages/578_Matrix2.png)
Your function should return
![1899_Matrix3.png](https://secure.tutorsglobe.com/CMSImages/1899_Matrix3.png)
which solves the original equations
3x + 2y + z = 11
2x + 3y +z = 13
x + y + 4z = 12
as x = 1, y = 3, z = 2
and, at the same time, the equations
3x + 2y + z = -5
2x + 3y +z = -4
x + y + 4z = 9
as x = -2, y = -1, z = 3.
Additionally, if you pass to your function a square matrix on the left augmented by the identity matrix on the right, such as
![2377_Matrix4.png](https://secure.tutorsglobe.com/CMSImages/2377_Matrix4.png)
your function should return the identity matrix on the left and the inverse of the original square matrix on the right.