Question
Write a MatLab function that calculates the determinant of a matrix. You should continue the Gauss Elimination down the diagonal to the last row. Count
Write a MatLab function that calculates the determinant of a matrix. You should continue the Gauss Elimination down the diagonal to the last row. Count the number of times you switch rows because each row exchange changes the sign of the determinant. When the matrix is in upper-triangular form, the determinant is the product of the diagonal elements with the proper sign. Your function should accept a square matrix of any size as an argument and return the scalar determinant. 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. Include all the functions your main function uses as local functions in the same script. We must be able to run your function to determine if it works correctly. Do not use any built-in MATLAB functions except size(), input(), fprintf() and zeros().
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