0% found this document useful (0 votes)
24 views1 page

Roll No:B-25: Assignment No: PROGRAM ON: Successive Approximation Method

This document contains the code for a program that uses the successive approximation method to find the root of an equation. The program takes an initial guess x1 for the root as input, calculates the function value at x1, and then iteratively calculates new values of x by applying the function g(x) = log(1.4/cos(x)) for n iterations, outputting the final root value x2. It also provides the actual solution using MATLAB's fzero function for comparison.

Uploaded by

Rushabh Meher
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views1 page

Roll No:B-25: Assignment No: PROGRAM ON: Successive Approximation Method

This document contains the code for a program that uses the successive approximation method to find the root of an equation. The program takes an initial guess x1 for the root as input, calculates the function value at x1, and then iteratively calculates new values of x by applying the function g(x) = log(1.4/cos(x)) for n iterations, outputting the final root value x2. It also provides the actual solution using MATLAB's fzero function for comparison.

Uploaded by

Rushabh Meher
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

ASSIGNMENT NO:

PROGRAM ON : Successive Approximation Method


Roll No:B-25

Function File :
Function g.m => function y=g(x)
y=log(1.4/cos(x));

Function dg.m => function y=dg(x)


y=tan(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 :

enter the value of first root x1=0.2

enter the no. of iterations n=5

The root of equation is x2=0.430590

Solver Solution :
x=fzero('exp(x)*cos(x)-1.4',0.2)

x =0.4336

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy