Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. clc, clear, close all;
  2. x1 = -2.5;
  3. y1 = -62;
  4. x2 = -1.5;
  5. y2 = -7.2;
  6. x3 = -.5;
  7. y3 = 8.3;
  8. x4 = 1;
  9. y4 = 3.7;
  10. x5 = 3;
  11. y5 = 45.7;
  12.  
  13. A=[x1;x2;x3;x4;x5];
  14. B=[A.^4 A.^3 A.^2 A ];
  15. K=[y1;y2;y3;y4;y5];
  16. C=horzcat(B,[1;1;1;1;1],K);
  17. D=rref(C);
  18. F=D(:,6)
  19. hold on;
  20. plot(A,transpose(K),' o')
  21. syms x
  22. fplot((F(1)*x^4)+(F(2)*x^3)+(F(3)*x^2)+(F(4)*x)+F(5))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement