I understand that this question has been addressed, however, newbie to software and struggling to apply solutions to my function. This is my code, I am unsure what needs to be added or removed. Please can you explain explicitly why you would add remove and the cause of the problem for my understanding.
function [L] = lagrangePseudo(x,y,xstar)n = length(x);for i = 0:n+1 prod = y; for j = 0:n+1 if i ~=j prod = prod*(xstar-x(j))/(x(i)-x(j)); end end sum = 0; L = sum+prod;end format longend
Best Answer