Professional Documents
Culture Documents
%program To Find Roots of Equation Using Biasing Method %MIS:111805033
%program To Find Roots of Equation Using Biasing Method %MIS:111805033
%program To Find Roots of Equation Using Biasing Method %MIS:111805033
%MIS:111805033
clear all;
clc;
x=polyval(f,a);
y=polyval(f,b);
acc=input('enter requaired accuracy:');
c=(a+b)/2;
n=polyval(f,c);
if (x*y>0)
disp('wrong guess');
else
while(abs(n)>acc)
c=(a+b)/2;
n=polyval(f,c);
if (x*n<0)
b=c;
else if (y*n<0)
a=c;
end
end
end
disp('one of the root is')
disp(c)
plot(dis,polyval(f,dis))
hold on
plot(c,0,'k*')
xlabel('x');
ylabel('f(x)');
end
OUTPUT:
0.6482
EQUATIOn 2:
1.6589
EQUATION 3:
1.0921
EQUATION 4:
0.6666