Question: Writeafunctionwithheader [ X ] = myFixedPoint ( f , g , tol,maxIter ) , wherefand gare function handles and tol and maxIterarestrictly positive scalars. The

Writeafunctionwithheader[X]= myFixedPoint(f,g,tol,maxIter),wherefand
gare function handles and tol and maxIterarestrictly positive scalars. The input argument,
maxIter, is also an integer. The output argument, X, should be a scalar satisfying | f (X)
g(X)|< tol; that is, X is a point that (almost) satisfies f(X)= g(X). To find X, you should
use the Bisection method with error metric, |F(m)|< tol. The function myFixedPoint
should give up after maxIter number of iterations and return X =[]if this occurs.
Test Cases:
>>f = @(x) x.^2-2;
>>[R,E]= myBisection(f,0,2,1e-1)
R =
1.00001.50001.25001.37501.4375
E =
1.00000.25000.43750.10940.0664
>>f = @(x)sin(x)-cos(x);
>>[R,E]= myBisection(f,0,2,1e-2)
R =
1.00000.50000.75000.87500.8125
E =
0.30120.39820.05010.12650.0383

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!