JoelSjogren

Untitled

Oct 25th, 2020
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. box% octave
  2. GNU Octave, version 5.2.0
  3. Copyright (C) 2020 John W. Eaton and others.
  4. This is free software; see the source code for copying conditions.
  5. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
  6. FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.
  7.  
  8. Octave was configured for "x86_64-pc-linux-gnu".
  9.  
  10. Additional information about Octave is available at https://www.octave.org.
  11.  
  12. Please contribute if you find this software useful.
  13. For more information, visit https://www.octave.org/get-involved.html
  14.  
  15. Read https://www.octave.org/bugs.html to learn how to submit bug reports.
  16. For information about changes from previous versions, type 'news'.
  17.  
  18. 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]
  19. M =
  20.  
  21. 1 0 0 0 1
  22. 0 1 1 1 0
  23. 0 1 1 1 0
  24. 0 1 1 1 0
  25. 1 0 0 0 1
  26.  
  27. octave:2> I = eye(5)
  28. I =
  29.  
  30. Diagonal Matrix
  31.  
  32. 1 0 0 0 0
  33. 0 1 0 0 0
  34. 0 0 1 0 0
  35. 0 0 0 1 0
  36. 0 0 0 0 1
  37.  
  38. octave:3> P = [I(:,2) I(:,3) I(:,4) I(:,1) I(:,5)]
  39. P =
  40.  
  41. 0 0 0 1 0
  42. 1 0 0 0 0
  43. 0 1 0 0 0
  44. 0 0 1 0 0
  45. 0 0 0 0 1
  46.  
  47. octave:4> P'*M*P
  48. ans =
  49.  
  50. 1 1 1 0 0
  51. 1 1 1 0 0
  52. 1 1 1 0 0
  53. 0 0 0 1 1
  54. 0 0 0 1 1
  55.  
  56. octave:5> eigs(M)
  57. ans =
  58.  
  59. 3.00000
  60. 2.00000
  61. -0.00000
  62. 0.00000
  63. 0.00000
  64.  
  65. octave:6> eigs([1 1 1; 1 1 1; 1 1 1])
  66. ans =
  67.  
  68. 3.0000e+00
  69. -5.6242e-16
  70. 7.3053e-18
  71.  
  72. octave:7> eigs([1 1; 1 1])
  73. ans =
  74.  
  75. 2
  76. 0
  77.  
  78. octave:8>
  79.  
Add Comment
Please, Sign In to add comment