Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clc
- x0 = [1 2 4 6 8 10];
- y0 = [6 6 4 2 0 0];
- x = 0:0.2:11
- hold on
- plot(x0, y0, 'g*')
- w2 = polyfit(x0, y0, 2);
- f2 = polyval(w2, x);
- plot(x, f2, 'r');
- w3 = polyfit(x0, y0, 3);
- f3 = polyval(w3, x);
- plot(x, f3, 'b');
- hold off;
- y=f_lagrange(x0,y0,x);
- plot(x,y,'c');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement