Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. clc;
  2. clear all;
  3. close all;
  4.  
  5. format long e;
  6.  
  7. e=0.0001;
  8. A=[1 2; 1 2+e];
  9. b=[4;4+e];
  10.  
  11. %cramer
  12. %wx=[4 2;4+e 2+e];
  13. %wx=det(wx);
  14. %wy=[1 4;1 4+e];
  15. %wy=det(wy);
  16. %det(A);
  17. %x=wx/det(A);
  18. %y=wy/det(A);
  19.  
  20. %odwracanie macierzy
  21. %iA=inv(A);
  22. %odwroc=iA*b;
  23. %disp(odwroc);
  24.  
  25. %Gauss
  26. %if det(A);
  27. %x=A\b;
  28. %sp=A*e;
  29. %end
  30.  
  31. %LUv1
  32. %[L,U]=lu(A)
  33. %lu1=inv(U)*inv(L)*b
  34.  
  35. %LUv2
  36. %[L,U]=lu(A)
  37. %ylu2=inv(L)*b
  38. %xlu2=inv(U)*ylu2
  39.  
  40. %QR
  41. %[q,r] = qr(A)
  42. %xgr=inv(r)*q'*B
  43.  
  44. %QR2
  45. %[Q, R]=qr(A)
  46. %xqr2=inv(R)*Q'*B
  47.  
  48. %SVD
  49. %[U, S, V]=svd(A);
  50. %xsvd=inv(V)*inv(S)*U'*B
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement