Professional Documents
Culture Documents
Roll No:B-25: Assignment No: PROGRAM ON: Successive Approximation Method
Roll No:B-25: Assignment No: PROGRAM ON: Successive Approximation Method
Function File :
Function g.m => function y=g(x)
y=log(1.4/cos(x));
Program File :
x1=input('enter the value of first root x1=');
n=input('enter the no. of iterations n=');
a=dg(x1);
while (abs(a)>1)
x1=input('enter the value of first root x1=');
a=dg(x1);
end
for i=1:1:n
x2=g(x1);
x1=x2;
end
fprintf('The root of equation is x2=%f',x2);
Program Output :
Solver Solution :
x=fzero('exp(x)*cos(x)-1.4',0.2)
x =0.4336