Advertisement
Guest User

Untitled

a guest
May 24th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Octave 0.28 KB | None | 0 0
  1. clc
  2.  
  3. x0 = [1 2 4 6 8 10];
  4. y0 = [6 6 4 2 0 0];
  5. x = 0:0.2:11
  6. hold on
  7.  
  8. plot(x0, y0, 'g*')
  9.  
  10. w2 = polyfit(x0, y0, 2);
  11. f2 = polyval(w2, x);
  12. plot(x, f2, 'r');
  13.  
  14. w3 = polyfit(x0, y0, 3);
  15. f3 = polyval(w3, x);
  16. plot(x, f3, 'b');
  17. hold off;
  18. y=f_lagrange(x0,y0,x);
  19. plot(x,y,'c');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement