Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Creating a matrix that calculates inverse and determinants without using the det and inv commands

1 回表示 (過去 30 日間)
Joao Pereira
Joao Pereira 2019 年 10 月 28 日
閉鎖済み: Stephan 2019 年 10 月 28 日
Create a function that calculates the determinant and the inverse of a generic 2 X 2 matrix, following the algorithm seen in class (see Lecture 2).
The function should be named invanddet2by2. The function takes a generic 2 X 2 matrix as input, and returns two outputs: the determinant and the inverse. It should do the following few things:
  1. It calculates the determinant
  2. If the determinant is zero, the inverse is set to be an empty matrix (i.e. you assign the value [], that's squared brackets with no values inside, which for Matlab means an empty matrix)
  3. If the determinant is non-zero, then it calculates the inverse according to the 4-steps algorithm seen in class
In the template solution below:
  1. DO NOT CHANGE UNDER ANY CIRCUMSTANCES THE NAME OF THE FUNCTION
  2. Add input and outputs in the parenthesis on the first line
  3. The determinant should be the first output, and the inverse should be the second output
  4. Add your calculations in the white space below the comments
  5. YOU CANNOT USE THE MATLAB FUNCTIONS det and inv!!!

回答 (0 件)

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by