Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Develop your own M-file for bisection in a similar fashion to Fig. 5.7 (see next page). However rather than using the maximum iterations and Eq.

image text in transcribed

image text in transcribed

Develop your own M-file for bisection in a similar fashion to Fig. 5.7 (see next page). However rather than using the maximum iterations and Eq. (5.5), employ Eq. (5.6) as your stopping criterion Make sure to round the result of Eq. (5.6) up to the next highest integer (Hint: the ceil function provides a handy way to do this). The first line of your function should be Eunction [root,Ea,ea,n bisectnew(func,xl, xu, Ead, varargin) Note that for the output, Ea = the approximate absolute error and ea the approximate percent relative error. Then develop your own script, called LastNameHmwk04Script to solve Prob. 5.1 Note that you MUST pass the parame ters via the argument. In addition, set up the function so that it uses a default value for Ead = 0 . 000001. old Ea.new. 1 00% Eq. 5.6: log(Ar Ed log 2 In a d Problem 5.1 Use bisection to determine the drag coefficient needed so that an 95-kg bungee jumper has a velocity of 46 m/s after 9 s of free fall. Note: The acceleration of gravity is 9.81 m/s. Start with initial guesses ofx1-0.2 and x,-0.5 and iterate until the approximate relative error falls below 5%. FIGURE 5.7 An M-file to implement the bisection method function [root , fx,ea, iter]=bisectifunc , x1,xu'es,maxit,varargin) % bisect: root location zeroes % [root.fx,ea,iter-bisectifunc .x1,xu , es ,maxit,p1, p2, ): uses bisection method to find the root of func % input % func-name of function x1, xulower and upper guesses es-desired relative error (default = 0.0001%) maxitmax imum allowable iterations (default p1,p2, = additional parameters used by func 50) % output % root-real root function value at root % ea = approximate relative error (%) iter number of iterations if nargin3, error('at least 3 input arguments required'),end test func(xl,varargin:)) func(xu,varargin:) if test 0, error('no sign change'),end narginc4lisempty (es), es-0.0001;end if nargin

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database 101

Authors: Guy Kawasaki

1st Edition

0938151525, 978-0938151524

More Books

Students also viewed these Databases questions