function [v] = val_lagr(a,f,x) n = length(a); v = 0; for k = 1:n l = 1; for i = 1:n if i ~= k l = l * (x-a(i))/(a(k)-a(i)); end end v = v + l*f(k); end end
To embed this project on your website, copy the following code and paste it into your website's HTML: