Question

In: Advanced Math

Write a Matlab function for a matrix that takes in a matrix in echelon form and...

Write a Matlab function for a matrix that takes in a matrix in echelon form and will return the row canonical form. The function cannot use rref, or any other matlab built in functions.

Solutions

Expert Solution

SOLUTION:

Given that data  Write a Matlab function for a matrix that takes in a matrix in echelon form and will return the row canonical form. The function cannot use rref, or any other matlab built in functions.

So the matlab function is given below

function To Reduced Row Echelon Form(Matrix M) is

    lead := 0

    rowCount := the number of rows in M

    columnCount := the number of columns in M

    for 0 ≤ r < rowCount do

        if columnCount ≤ lead then

            stop

        end if

        i = r

        while M[i, lead] = 0 do

            i = i + 1

            if rowCount = i then

                i = r

                lead = lead + 1

                if columnCount = lead then

                    stop

                end if

            end if

        end while

        Swap rows i and r

        If M[r, lead] is not 0 divide row r by M[r, lead]

        for 0 ≤ i < rowCount do

            if i ≠ r do

                Subtract M[i, lead] multiplied by row r from row i

            end if

        end for

        lead = lead + 1

    end for

end function


Related Solutions

Show and explain how to obtain the echelon form of any matrix using Matlab.
Show and explain how to obtain the echelon form of any matrix using Matlab.
A. Write a function in MATLAB called findTranspose that takes in as input any matrix or...
A. Write a function in MATLAB called findTranspose that takes in as input any matrix or any vector and simply returns back the transpose of that input. You can always verify your answer by using the inbuilt transpose function in MATLAB, however, you cannot use the transpose function directly when writing your code. Here is the starter code that we are providing to help you get started %x is the input vector or matrix. You can find the %size that...
MATLAB Function: (Backward substitution) Write a function that takes an upper triangular matrix U, and a...
MATLAB Function: (Backward substitution) Write a function that takes an upper triangular matrix U, and a vector b as input and returns the solution of the linear system U x = b. Use this function in the case when U is made of the numbers [(3,2,1),(0,5,4),(0,0,6)], and b = [1,1,−6]^T.
Rank of a Matrix Using the Echelon Form.
Find the Rank of a Matrix Using the Echelon Form of the above matrix.Give details step by step.
11. Given a row echelon form or the reduced row echelon form of an augmented matrix...
11. Given a row echelon form or the reduced row echelon form of an augmented matrix of a system of equations, determine the number of solutions the system has.
B. Write a function in MATLAB called findInverseOf2x2Matrix that takes in as input any square matrix...
B. Write a function in MATLAB called findInverseOf2x2Matrix that takes in as input any square matrix of size 2 × 2 and returns back the inverse of that matrix if one exists. If no inverse exists, print back a suitable error message. You can safely assume that we will test your code on square matrices of size 2 × 2 only. You can always verify your answer by using the inbuilt inverse function in MATLAB, however, you cannot use the...
1. For both systems below form the augmented matrix, reduce the augmented matrix to echelon form...
1. For both systems below form the augmented matrix, reduce the augmented matrix to echelon form (zeros below the diagonal), and give the solution to the system. (a) x – 2y + z = 0; 2x + 3y – z = 16; 3x – y – 3z = 23. (b) 2x – 3y + z = -3; x + 2y – 5z = -29; 3x – y + 2z = -2
The following matrix is in reduced row echelon form. Decode from the matrix the solution of...
The following matrix is in reduced row echelon form. Decode from the matrix the solution of the corresponding system of linear equations or state that the system is inconsistent. (If the system is dependent assign the free variable the parameter t. If the system is inconsistent, enter INCONSISTENT.) 1 0 5 −4 0 1 −8 10 0 0 0 0 (x1, x2, x3) =
Give an example of an augmented matrix in echelon form corresponding to a system of 2...
Give an example of an augmented matrix in echelon form corresponding to a system of 2 equations in three unknowns satisfying each of the following conditions or explain why it is not possible. (a) No solutions (b) One unique solution (c) Infinitely many solutions.
Write the following matrices into row echelon form.
Exercise1. Write the following matrices into row echelon form.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT