Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- box% octave
- GNU Octave, version 5.2.0
- Copyright (C) 2020 John W. Eaton and others.
- This is free software; see the source code for copying conditions.
- There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.
- Octave was configured for "x86_64-pc-linux-gnu".
- Additional information about Octave is available at https://www.octave.org.
- Please contribute if you find this software useful.
- For more information, visit https://www.octave.org/get-involved.html
- Read https://www.octave.org/bugs.html to learn how to submit bug reports.
- For information about changes from previous versions, type 'news'.
- octave:1> M = [1 0 0 0 1; 0 1 1 1 0; 0 1 1 1 0; 0 1 1 1 0; 1 0 0 0 1]
- M =
- 1 0 0 0 1
- 0 1 1 1 0
- 0 1 1 1 0
- 0 1 1 1 0
- 1 0 0 0 1
- octave:2> I = eye(5)
- I =
- Diagonal Matrix
- 1 0 0 0 0
- 0 1 0 0 0
- 0 0 1 0 0
- 0 0 0 1 0
- 0 0 0 0 1
- octave:3> P = [I(:,2) I(:,3) I(:,4) I(:,1) I(:,5)]
- P =
- 0 0 0 1 0
- 1 0 0 0 0
- 0 1 0 0 0
- 0 0 1 0 0
- 0 0 0 0 1
- octave:4> P'*M*P
- ans =
- 1 1 1 0 0
- 1 1 1 0 0
- 1 1 1 0 0
- 0 0 0 1 1
- 0 0 0 1 1
- octave:5> eigs(M)
- ans =
- 3.00000
- 2.00000
- -0.00000
- 0.00000
- 0.00000
- octave:6> eigs([1 1 1; 1 1 1; 1 1 1])
- ans =
- 3.0000e+00
- -5.6242e-16
- 7.3053e-18
- octave:7> eigs([1 1; 1 1])
- ans =
- 2
- 0
- octave:8>
Add Comment
Please, Sign In to add comment