How can I create a function which outputs two variables for calculating the eigenvalue * eigenvector

2 views (last 30 days)
m1 = [7 3; 3 -1] % Matrix
[Vectors, DiagonalWithValues] = eig(m1)
ListEvalues = diag(DiagonalWithValues)
How can I implement a function which takes these 3 inputs (1. initial matrix, 2. eigenvectors, 3.eigenvalues) and returns two variables
1. a boolean variable, which indicates if both are equal
2. result of the operation for example if they are not equal it should return -1
  1 Comment
Dyuman Joshi
Dyuman Joshi on 9 May 2022
Use isequal() for the 1st output
Use if else for the 2nd output. But what is the value of 2nd output if they are equal?

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by