100% found this document useful (3 votes)
1K views

Experiment (3) Bisection Method in MATLAB: Objective: Equipment: 3. Background

This document describes an experiment using the bisection method in MATLAB to find the roots of nonlinear equations. It provides the background on the bisection method and outlines the procedure to create a script file to apply the method to equations like x^3 + 4x^2 - 10 and x^3 - 6x^2 + 10x - 4. The results show the root estimates converge after iterations between the initial intervals. Discussion questions ask to consider applying the method to tan(x) on (0,3) and the equation exp(x) - 3x^2.
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
100% found this document useful (3 votes)
1K views

Experiment (3) Bisection Method in MATLAB: Objective: Equipment: 3. Background

This document describes an experiment using the bisection method in MATLAB to find the roots of nonlinear equations. It provides the background on the bisection method and outlines the procedure to create a script file to apply the method to equations like x^3 + 4x^2 - 10 and x^3 - 6x^2 + 10x - 4. The results show the root estimates converge after iterations between the initial intervals. Discussion questions ask to consider applying the method to tan(x) on (0,3) and the equation exp(x) - 3x^2.
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/ 4

3th year ; 2nd semester numerical analysis lab

Experiment (3)
Bisection Method in MATLAB

1. Objective: to find the root of non-linear equation using Bisection Method in MATLAB.
2. Equipment: pc and MATLAB software.
3. Background:

4. Procedure:
Create a script file and type the following code
Write a program to find the roots of the following equations using bisection method:
a. X3 + 4 x2 -10
60

50

40

30

20

10

-10
0 0.5 1 1.5 2 2.5 3

A. L. Reem shakir 1
3th year ; 2nd semester numerical analysis lab

clear all;clc
% first plot the function
x=0:0.05:5;
f=@(x) (x.^3)+(4*(x.^2))-10;
plot(x,f(x));grid
a=input ('a=');
b=input ('b=');
tol=0.00001;

i=0
while (abs(a-b)> tol);
fa=f(a);
fb=f(b);
c=(a+b)/2;
fc=f(c);
fprintf('%13.4f %13.4f %13.4f %13.4f \n',a,b,c,fc)
if (fa *fc > 0);
a=c;
else
b=c;
end
i=i+1;
end

ans c= 1.365173 for [1 2]

b. X3 - 6 x2 +10 x -4

-1

-2

-3

-4
0 0.5 1 1.5 2 2.5 3 3.5 4

A. L. Reem shakir 2
3th year ; 2nd semester numerical analysis lab

clear all;clc
% first plot the function
x=0:0.05:4;
f=@(x) (x.^3)-(6.*(x.^2))+10*x - 4;
plot(x,f(x));grid

a=input ('a=');
b=input ('b=');
tol=0.00001;

i=0
while (abs(a-b)> tol);
fa=f(a);
fb=f(b);
c=(a+b)/2;
fc=f(c);
fprintf('%13.4f %13.4f %13.4f %13.4f \n',a,b,c,fc)
if (fa *fc > 0);
a=c;
else
b=c;
end
i=i+1;
end

ans c= 0.585793 for [0 1]

c= 1.999992 for [1.5 2.5]

c = 3.414207 for [3 4]

5. Discussion
1. Consider f(x) = tan(x) on the interval (0,3). Use the 20 iterations of the bisection method and see what
happens. Explain the results that you obtained.
2. Write a program to find the roots of the following equation using bisection method:
F(x) = exp (x) - 3 x 2

A. L. Reem shakir 3
3th year ; 2nd semester numerical analysis lab

A. L. Reem shakir 4

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