0% found this document useful (0 votes)
38 views2 pages

Submitted By: 18BCM0135 (Atmadeep Dutta) Date: 28.7.2020

The document is a MATLAB code submitted by a student named Atmadeep Dutta to their faculty member Dr. Monash Purushothaman for Experiment 2. The code compares the regular falsi and modified regular falsi numerical methods to find the root of the function f(x) = x^10 - 1 between the limits of 0 and 1.3. It calculates the iterations required for each method and provides justification for the results. The code prompts the user to enter the function, lower limit, and upper limit, then iteratively calculates the root and checks for convergence within the specified error tolerance.

Uploaded by

Atmadeep Dutta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views2 pages

Submitted By: 18BCM0135 (Atmadeep Dutta) Date: 28.7.2020

The document is a MATLAB code submitted by a student named Atmadeep Dutta to their faculty member Dr. Monash Purushothaman for Experiment 2. The code compares the regular falsi and modified regular falsi numerical methods to find the root of the function f(x) = x^10 - 1 between the limits of 0 and 1.3. It calculates the iterations required for each method and provides justification for the results. The code prompts the user to enter the function, lower limit, and upper limit, then iteratively calculates the root and checks for convergence within the specified error tolerance.

Uploaded by

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

Submitted by: 18BCM0135 [Atmadeep Dutta]

Date : 28.7.2020
Faculty: Dr. Monash Purushothaman.
Experiment 2
Develop a MATLAB code to identify the difference between
regula falsi and modified regula falsi numerical method for the
expression f(x) = x10-1 between the limits 0and 1.3. Compare
the number of iteration involved and give justification for the
obtained result.
Code
clc;
clear;
disp ('Name: Atmadeep Dutta');
disp ('Reg No 18BCM0135');
disp('Experiment 2');
fx=input('Enter te function', 's');
xl=input('Enter the lower limit: ');
xu=input('Enter the upper limit: ');
x=xl; fxl=eval(fx);
x=xu; fxu=eval(fx);
if (fxl*fxu) <0
disp('Atleast one root');
n=100; es=0.01;
il=0; iu=0;
for i=1:n
xm=(xl+xu)/2;
x=xm; fxm=eval(fx);
if (fxl*fxm)<0
xu=xm; fxu=fxm;
il=il+1;
iu=0;
if il>=2
fxl=fxl/2;
end
elseif (fxu*fxm)<0
xl=xm; fxl=fxm;
iu=iu+1;
il=0;
if iu>=2
fxu=fxu/2;
end
end
if i>1
ea=abs((xm-xmold)/xm)*100;
if ea<=es
fprintf('Root = %f\t Iteretation involved =
%d\n', xm, i);
break;
end
end
xmold=xm;
end
else
disp('No roots between the limits. return the program
with new initial guesses');
end

Output

You might also like