Problem Solve Matlab Bisection Method
·
fx = (x.^3)-(0.2.*x.^2)+4.99.*10.^-3
x = 1:8;
plot(fx,x);
grid on
fx =
Columns 1 through 4
0.8050
7.2050 25.2050 60.8050
Columns 5 through 8
120.0050
208.8050 333.2050 499.2050
·
BISECTION
fx
BISECTION
fx
syms x
fx = (x^3)-(0.2*x^2)+4.99*10^-3;
xl = 1;
xu = 8;
fxl = subs(fx,x,xl);
fxu = subs(fx,x,xu);
if fxl*fxu <0
break
end
n = 100;
es = 0.00001;
ea = 1;
xm = (xl+xu)/2;
N = [xl xu xm ea ea];
for i=1:n
xm = (xl+xu)/2;
fxm = subs(fx,x,xm);
if fxl*fxm<0
ea = abs((xm-xu)/xm);
xu = xm;
else
ea = abs((xm-xl)/xm);
xl = xm;
end
if ea<=es
break
end
N = [N;xl xu xm ea es];
end
N
HASIL BISECTION
Columns
1 through 4Columns 5
1.0000
8.0000 4.5000 1.0000
1.0000
4.5000 8.0000
4.5000 0.7778 0.0000
6.2500 8.0000
6.2500 0.28000.0000
7.1250
8.0000 7.1250 0.12280.0000
7.5625
8.0000 7.5625 0.05790.0000
7.7813
8.0000 7.7813 0.02810.0000
7.8906
8.0000 7.8906 0.01390.0000
7.9453
8.0000 7.9453 0.00690.0000
7.9727
8.0000 7.9727 0.00340.0000
7.9863
8.0000 7.9863 0.00170.0000
7.9932
8.0000 7.9932 0.00090.0000
7.9966
8.0000 7.9966 0.00040.0000
7.9983
8.0000 7.9983 0.00020.0000
7.9991
8.0000 7.9991 0.00010.0000
7.9996
8.0000 7.9996 0.00010.0000
7.9998
8.0000 7.9998 0.00000.0000
7.9999 8.0000
7.9999 0.00000.0000
Komentar
Posting Komentar