why im getting a sparse error in line 4 in editor, actually my cursor is red
1 回表示 (過去 30 日間)
古いコメントを表示
Haseeb Ahmed Janjua
2017 年 10 月 4 日
回答済み: Walter Roberson
2017 年 10 月 4 日
function c = bisection(a,b,tolb)
while (b-a)/2> tolb
midp=a+b/2;
if pb(midp)=0
fprintf("we found answer")
break
end
if pb(a)*pb(midp)<0
b=midp;
else a=midp
end
end
0 件のコメント
採用された回答
Walter Roberson
2017 年 10 月 4 日
You have
if pb(midp)=0
MATLAB uses == for comparisons, not =
0 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!