Coefficient for Langrange Polynomial n=length(x); for k=1:n d(k)=1; for i=1:n If i~=k d(k)=d(k)*(x(k)-x(i)); end c(k)=y(k)/d(k); end end Evaluate Langrange Polynomial function p=LangrangeEval(t,x,c) m=length(x); for i=1:length(t) p(i)=0; for j=1:

1 Ansicht (letzte 30 Tage)
Hello everyone. I need help for understanding this code. Thanks Coefficient for Langrange Polynomial n=length(x); for k=1:n d(k)=1; for i=1:n If i~=k d(k)=d(k)*(x(k)-x(i)); end c(k)=y(k)/d(k); end end
Evaluate Langrange Polynomial function p=LangrangeEval(t,x,c) m=length(x); for i=1:length(t) p(i)=0; for j=1:m; N(j)=1; for k=1:m; if(j~=k) N(j)=N(j)*(t(i)-x(k)); end end p(i)=p(i)+N(j)*c(j); end end

Antworten (0)

Kategorien

Mehr zu Polynomials finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by