why im getting a sparse error in line 4 in editor, actually my cursor is red
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Haseeb Ahmed Janjua
am 4 Okt. 2017
Beantwortet: Walter Roberson
am 4 Okt. 2017
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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 4 Okt. 2017
You have
if pb(midp)=0
MATLAB uses == for comparisons, not =
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Sparse Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!