Advertisement
JoelSjogren

Untitled

Jan 5th, 2017
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. data = [
  2. 0 2 5 1
  3. -6 3 2 -3
  4. 1 4 7 -2
  5.  
  6. 2 2 1 1
  7. 0 3 1 -3
  8. 5 4 0 -2
  9.  
  10. 0 8 10 1
  11. -6 12 4 -3
  12. 1 16 14 -2
  13.  
  14. 1 2 5 1
  15. 5 3 11 -3
  16. -6 4 2 -2
  17.  
  18. 1 2 2 -2
  19. 5 3 3 6
  20. -6 4 1 4
  21. ]
  22.  
  23. for i=1:5 # all questions
  24. # does a+bs = c+dt have a solution?
  25. a = data((1:3)+(i-1)*3,1);
  26. b = data((1:3)+(i-1)*3,2);
  27. c = data((1:3)+(i-1)*3,3);
  28. d = data((1:3)+(i-1)*3,4);
  29. M = [-a+c b d];
  30. disp(det(M));
  31. end
  32.  
  33. %{ This is the output:
  34.  
  35. >> isctq
  36. data =
  37.  
  38. 0 2 5 1
  39. -6 3 2 -3
  40. 1 4 7 -2
  41. 2 2 1 1
  42. 0 3 1 -3
  43. 5 4 0 -2
  44. 0 8 10 1
  45. -6 12 4 -3
  46. 1 16 14 -2
  47. 1 2 5 1
  48. 5 3 11 -3
  49. -6 4 2 -2
  50. 1 2 2 -2
  51. 5 3 3 6
  52. -6 4 1 4
  53.  
  54. 40
  55. 47
  56. 92.000
  57. 0
  58. 146
  59. >>
  60.  
  61. %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement