Help! Error in bisection method

%initial guess B1=14.1067 B=14.1068:-0.01:5.84 % value of function Value of function on B1= Xm1 For I= 1:length(B) Xm0= value of function (at I=1: length B) If Xm0*Xm1< 0 Print(root is exist) End End B0= B(I) K=0 While (B1-B0)/B1> error B2= (B1+B0)/2 XM2= value of function at B2 If Xm0*XM2< 0 B0= B2 Xm0= XM2 End If Xm1*XM2<0 Xm1=XM2 B1=B2 End K=K+1 End

댓글 수: 4

darova
darova 2020년 4월 12일
Where is the code?
Karishma Joshi
Karishma Joshi 2020년 4월 12일
I used this code but I can't get correct answer. Value of function is more then one at my root
Geoff Hayes
Geoff Hayes 2020년 4월 13일
Karishma - please format the code as it isn't clear what is a comment and what isn't. Also, it looks like there is some syntax that is not valid for MATLAB.

답변 (0개)

이 질문은 마감되었습니다.

질문:

2020년 4월 12일

마감:

2021년 8월 20일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by