Why it says undefined variable x2
古いコメントを表示
function [x2] = secant(f, x0, x1)
while true
x2 =f(x1)*(x2-x0)/f(x0)+x1;
if x1 == x2
return;
end
x0 = x1;
x1 = x2;
end
end
回答 (1 件)
James Tursa
2018 年 9 月 26 日
0 投票
You have x2 appearing on the right hand side of your first assignment, before it has been defined.
カテゴリ
ヘルプ センター および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!