Advertisement
Guest User

GaussMatlab

a guest
Sep 19th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.38 KB | None | 0 0
  1. %% gauss con funcion
  2. function y=FunGauss(A,B)
  3. A=[2 -3 -1;3 2 -5;2 4 -1]
  4. B=[3;-9;-5]
  5. [n n]=size(A);
  6. A=[A';B']';
  7. x=zeros(n,1);
  8. for p=1:n
  9.     for k=[1:p-1,p+1:n];
  10.         m=-A(k,p)/A(p,p);
  11.         A(k,:)=A(k,:)+m*A(p,:)
  12.     end
  13. end
  14. x=A(:,n+1)./diag(A)
  15.  
  16. % Grafica
  17. [x,y]=meshgrid(-5:05);
  18. z=2*x -3*y -1
  19. surf(x,y,z);
  20. xlabel('X');
  21. ylabel('Y');
  22. zlabel('Z= C');
  23. colorbar
  24. hold on
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement