error running the code in while command in bisection method
显示 更早的评论
umerfunction='x.^3';
x_lower=0;
x_upper=1;
x_mid=(x_lower+x_upper)/2;
i=0;
while(abs(umerfunction(x_mid))>0.0001)
fx=umerfunction(x_mid);
X=[i,fx,x_upper,x_lower];
disp X;
if(umerfunction(x_mid)*umerfunction(x_upper))<0
x_lower=x_mid;
else x_upper=x_mid;
end
ERROR:
Array indices must be positive integers or logical values.
Error in bisection (line 7)
while(abs(umerfunction(x_mid))>0.0001)
how to solve that issue? i m very frustated now regarding solving this.Thanks and honours in advance
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Function Creation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!