Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function LG = lagranges(x, y, a)
- n = length(x);
- LG = 0;
- for i = 1 : n
- w = 1;
- for j = 1 : n
- if i ~= j
- w = (w * (a - x(j))) / (x(i) - x(j));
- end
- end
- LG = LG + w * y(i);
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement