Write a script called RootFinding. This script should ask the user which method
ID: 643284 • Letter: W
Question
Write a script called RootFinding. This script should ask the user which method they wish to use to solve the problem: bisection, Newton-Raphson or the fzero function (with fzero as the default) and then call the appropriate function. For a given problem, this script defines all the fields in the structure "problem" (that is, it assigns values to the fields, using the struct command) necessary to call either Bisection2, NewtownRaphson2, or fzero. For the latter, use the following syntax : [root,FVAL,EXITFLAG,OUTPUT] = fzero(problem) and note that fzero requires the following problem structure: problem.objective problem.xi % use only a scalar, not a vector problem.solver = 'fzero'; % a required part of the structure problem.options = optimset(@fzero); % default options
Explanation / Answer
bisection.m
newton.m
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.