JoelSjogren

Untitled

Nov 4th, 2020
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 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> A=[1;1]; B=[3;-1]; C=[4;3]; P=[5;-7]; Q=[7;-2]; R=[2;-1];
  19. octave:2> homo = @(v) [v;1];
  20. octave:3> T1 = [homo(A) homo(B) homo(C)]
  21. T1 =
  22.  
  23. 1 3 4
  24. 1 -1 3
  25. 1 1 1
  26.  
  27. octave:4> T2 = [homo(P) homo(Q) homo(R)]
  28. T2 =
  29.  
  30. 5 7 2
  31. -7 -2 -1
  32. 1 1 1
  33.  
  34. octave:5> aff = @(v) v(1:2)/v(3);
  35. octave:6> aff((T2/T1) * homo(A))
  36. ans =
  37.  
  38. 5.0000
  39. -7.0000
  40.  
  41. octave:7>
Add Comment
Please, Sign In to add comment