Please explain for me this code , and what does each function do in detail ?

6 vues (au cours des 30 derniers jours)
Alhussain AlAbbas
Alhussain AlAbbas le 13 Oct 2021
Commenté : Kevin Holly le 14 Oct 2021
function s=lagrangeP(x,X,Y)
format long
n=size(X);
L=ones(n);
for i=1:n
for j=1:n
if (i~=j)
L(i)=L(i).*(x-X(j))./(X(i)-X(j));
end
end
end
s=0;
for i=1:n
s=s+Y(i)*L(i);
end

Réponses (1)

Kevin Holly
Kevin Holly le 13 Oct 2021
  3 commentaires
Kevin Holly
Kevin Holly le 14 Oct 2021
No problem. If this answers your question, I would appreciate it if you accepted the answer.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by