What does the following code do?
이전 댓글 표시
myFunction =@(x)x^2-6;
x_lower=0;
x_upper=5;
x_mid=(x_lower+x_upper)/2;
while abs(myFunction(x_mid))>0.01
if (myFunction(x_mid)*myFunction(x_upper))<0
x_lower =x_mid;
else
x_upper = x_mid;
x_mid=(x_lower+x_upper)/2;
end
x_mid=(x_lower+x_upper)/2;
end
fprintf('the root is %g; x_mid)
댓글 수: 4
KALYAN ACHARJYA
2019년 11월 4일
편집: KALYAN ACHARJYA
2019년 11월 4일
Which line do you have issue?
Raban Nghidinwa
2019년 11월 4일
Star Strider
2019년 11월 4일
So asking us to explain it to you is doing your homework for you, giving you an unfair advantage over your classmates who are doing this themselves, likely without any outside help.
Raban Nghidinwa
2019년 11월 4일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 LaTeX에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!