Question

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));

If f(a)*f(x) < 0

then b=x;

else a=x;

end while.

Homework Answers

Answer #1

clc;
clear all;

format short
f=@(x)exp(x)-x^2 + 3*x-2 ; %function


a=0;b=1; % interval
% checking sign
if(f(b)<f(a))
m=a;
a=b;
b=m;
end

n=1;
err=0.1;
tol=1e-5;

while((err>tol))
  
c=(a*f(b)-b*f(a))/(f(b)-f(a));% false method formula
if ( f(c) == 0 )
break;
elseif ( f(a)*f(c) < 0 )
b = c;
else
a = c;
end
  
err=abs(f(c)); % error
n=n+1; % update next iteration
end
disp('root of function')
c
disp('number of iteration')

%%%%%%%%%%%%%%%%% Answer

root of function

c =

0.2575

number of iteration

n =

5

>>

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
Using Matlab 1. Give the flowchart for finding the root of the function f(x) = [tanh⁡(x-2)]...
Using Matlab 1. Give the flowchart for finding the root of the function f(x) = [tanh⁡(x-2)] [sin⁡(x+3)+2] with the following methods (6 significant figures required): a) Modified Regula Falsi (Choose two reasonable integers as your initial upper and lower bounds) b) Newton’s Method (Choose one reasonable integer as your initial guess for the root)
Use Newton's method with the specified initial approximation x1 to find x3, the third approximation to...
Use Newton's method with the specified initial approximation x1 to find x3, the third approximation to the root of the given equation. x3 + 5x − 2 = 0,    x1 = 2 Step 1 If f(x) = x3 + 5x − 2, then f'(x) = _____ x^2 + _____ 2- Use Newton's method to find all roots of the equation correct to six decimal places. (Enter your answers as a comma-separated list.) x4 = 5 + x .
One old-time method to estimate the square root of any positive number a is called divide...
One old-time method to estimate the square root of any positive number a is called divide and average: xi+1 = xi + a xi 2 Show that this formula is equivalent to Newton method. Hint: Start by solving f (x) = x 2 − a = 0. Use Matlab code
Newton's method: For a function ?(?)=ln?+?2−3f(x)=ln⁡x+x2−3 a. Find the root of function ?(?)f(x) starting with ?0=1.0x0=1.0....
Newton's method: For a function ?(?)=ln?+?2−3f(x)=ln⁡x+x2−3 a. Find the root of function ?(?)f(x) starting with ?0=1.0x0=1.0. b. Compute the ratio |??−?|/|??−1−?|2|xn−r|/|xn−1−r|2, for iterations 2, 3, 4 given ?=1.592142937058094r=1.592142937058094. Show that this ratio's value approaches |?″(?)/2?′(?)||f″(x)/2f′(x)| (i.e., the iteration converges quadratically). In error computation, keep as many digits as you can.
Use the Bisection Method to locate all solutions of the following equations. Sketch the function by...
Use the Bisection Method to locate all solutions of the following equations. Sketch the function by using Matlab’s plot command and identify three intervals of length one that contain a root. Then find the roots to six correct decimal places. (a) 2x3 − 6x − 1 = 0 (b) ex−2 + x3 − x = 0 (c) 1 + 5x − 6x3 − e2x = 0 **MUST BE DONE IN MATLAB AND NEEDS CODE
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...
Find the root of the function: f(x)=2x+sin⁡(x)-e^x, using Newton Method and initial value of 0. Calculate...
Find the root of the function: f(x)=2x+sin⁡(x)-e^x, using Newton Method and initial value of 0. Calculate the approximate error in each step. Use maximum 4 steps (in case you do not observe a convergence).
Use Newton’s method to find a 6-decimal place approximation to the positive root of f(x) =...
Use Newton’s method to find a 6-decimal place approximation to the positive root of f(x) = x 5 − 7x 2 + 4 that is nearest to the origin. (a) Tell your “Newton function” R(x) (b) Tell what technology you used. (“Handheld calculator” is not acceptable.) (c) Tell your initial guess (x1) and the iterations that you observed. (d) Tell your “stopping criteria.” That is, why did you stop after n iterations
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.
How do I implement this method BalancedByNodeCount() ? public class BinarySearchTree { private Node root; private...
How do I implement this method BalancedByNodeCount() ? public class BinarySearchTree { private Node root; private boolean isBalancedByNodeCount() { /**************************************************************************** Implement this method and replace the return statement below with your code. * Definition of Balance tree (On page 372 of book): * An unbalanced tree is created when most of the nodes are on one side of the root or the other. ****************************************************************************/    return false; }       public static void main(String args[]) { int[] values1 = {50,...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT