where is the error? lagrange
조회 수: 15 (최근 30일)
이전 댓글 표시
when i execute this code, error comes in y^lag;
how can i fix it?
function approx = lagrange(x,y,x_bar)
n = length(x);
for i = 1:n
value = ones(1,length(x_bar));
for k = 1 : n
if k ~= i
value = value.^(x_bar-x(k))/(x(i)-x(k));
end
end
lag (i,:) = value ;
end
approx = y^lag;
end
댓글 수: 0
답변 (1개)
Ameer Hamza
2020년 5월 3일
편집: Ameer Hamza
2020년 5월 3일
Use element-wise exponential operator
approx = y.^lag;
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Decomposition에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!