Question

The given equation has a root in the indicated interval.In MatLab, use the Bisection method to...

The given equation has a root in the indicated interval.In MatLab, use the Bisection method to generate the first four midpoints and intervals (besides the original interval given) containing the root.

equation: e^x - 2x= 2,[0,2]

Homework Answers

Answer #1

--------------------------------------------------------------------------------------------------------------------------------

code

-------------------------------------------------------------------------------------------------------------------------

clear all;

f=@(x) exp(x)-2*x-2;      
a=0;
b=2;

fprintf('Given Interval %f %f\n',a,b);

j=0;

for i=1:4
c=(a+b)/2;
fprintf('For Interval-%d %f %f Mid Point is %f \n',j,a,b,c);
j=j+1;
if f(c)>0
   b=c;
else a=c;
end
end


fprintf('Root of given equation is %f',c)

----------------------------------------------------------------------------

Output

------------------------------------------------------------------------------------------

Given Interval 0.000000 2.000000
For Interval-0 0.000000 2.000000 Mid Point is 1.000000
For Interval-1 1.000000 2.000000 Mid Point is 1.500000
For Interval-2 1.500000 2.000000 Mid Point is 1.750000
For Interval-3 1.500000 1.750000 Mid Point is 1.625000
Root of given equation is 1.625000>>

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Each equation has one root. Use Newton’s Method to approximate the root to eight correct decimal...
Each equation has one root. Use Newton’s Method to approximate the root to eight correct decimal places. (a) x3 = 2x + 2 (b) ex + x = 7 (c) ex + sin x = 4 **MUST BE DONE IN MATLAB AND NEED CODE
Use the bisection method to find roots for the following function on the intervals indicated: h(x)...
Use the bisection method to find roots for the following function on the intervals indicated: h(x) = x + 10 - x cosh(50/x), on [120,130]
Find root of the equation cos (x) = xex using Bisection method. Make calculation for 4...
Find root of the equation cos (x) = xex using Bisection method. Make calculation for 4 iterations. Choose xl= 0 and xu= 1. Determine the approximate error in each iteration. Give the final answer in a tabular form.
Using Matlab, find an approximation by the method of false position for the root of function...
Using Matlab, find an approximation by the method of false position for the root of function f(x) = ex −x2 + 3x−2 accurate to within 10−5 (absolute error) on the interval [0,1]. Please answer and show code. Pseudo Code for Method of False Position: Given [a,b] containing a zero of f(x); tolerance = 1.e-7; nmax = 1000; itcount = 0; error = 1; while (itcount <=nmax && error >=tolerance) itcount = itcount + 1; x= a - ((b-a)/(f(b)-f(a)))f(a) error =abs(f(x));...
Solve the following problem using the MATLAB environment Write a function [approx_root, num_its] = bisection(f,a,b,tol) that...
Solve the following problem using the MATLAB environment Write a function [approx_root, num_its] = bisection(f,a,b,tol) that implements the bisection method. You function should take as input 4 arguments with the last argument being optional, i.e, if the user does not provide the accuracy tol use a default of 1.0e-6 (use varargin to attain this). Your function should output the approximate root, approx_root and the number of iterations it took to attain the root, num_its. However, if the user calls the...
Use the method of Frobenius and the larger indicial root to find the first four nonzero...
Use the method of Frobenius and the larger indicial root to find the first four nonzero terms in the series expansion about x=0 for a solution to the given equation for x>0. 3xy''+(2-x)y'-3y=0
Let f(x) = x^3 + x - 4 a. Show that f(x) has a root on...
Let f(x) = x^3 + x - 4 a. Show that f(x) has a root on the interval [1,4] b. Find the first three iterations of the bisection method on f on this interval c. Find a bound for the number of iterations needed of bisection to approximate the root to within 10^-4
1. Use the Intermediate Value Theorem to show that f(x)=x3+4x2-10 has a real root in the...
1. Use the Intermediate Value Theorem to show that f(x)=x3+4x2-10 has a real root in the interval [1,2]. Then, preform two steps of Bisection method with this interval to find P2.
Each equation has one real root. Use Newton’s Method to approximate the root to eight correct...
Each equation has one real root. Use Newton’s Method to approximate the root to eight correct decimal places. (a) x5 + x = 1 (b) sin x = 6x + 5 (c) ln x + x2 = 3 **MUST BE DONE IN MATLABE AND SHOW CODE
The indicated function y1(x) is a solution of the associated homogeneous differential equation. Use the method...
The indicated function y1(x) is a solution of the associated homogeneous differential equation. Use the method of reduction of order to find a second solution y2(x) and a particular solution of the given nonhomoegeneous equation. y'' − y'  = e^x y1 = e^x