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!