Question: This problem is designed to help you achieve the following course objectives: Find roots of equations using bracketing and open methods; explain the differences between
This problem is designed to help you achieve the following course objectives:
Find roots of equations using bracketing and open methods; explain the differences between the two methods and point out the advantage of each method.
Calculate minimum or maximum of a function.
Problem Description: Consider the following nonlinear function:
f(x)=x^4 + 2 x^2 - 5x + log(x+3)
(i) Plot f(x) in a figure to observe that it reaches a local minimum for some value of x in the range 1< x <1.
(ii) Compute the derivative, f'(x), plot it in the same figure, and observe that f' has a root in the range -1< x <1.
(iii) Observe that the root of f'(x) is exactly the value of x for which f(x) reaches its minimum.
(iv) Develop a MATLAB function to find the minimum of f(x) by finding the root of f'(x) using the Newton-Raphson method. Specifically, your function should take as input the error tolerance for the value of x* corresponding to the minimum of f(x). It should output both x* and the minimum function value f(x*). Read the function template for more details.
Given Code
function [xmin, fmin] = Minimize(es)
%% Input
% es: Stopping criterion for the approximate absolute *percent*
% relative error in xmin (scalar)
%% Output
% xmin: value of x at which function f(x) reaches minimum (-1 < xmin < 1)
% fmin: minimum of f(x), i.e. f(xmin).
% -------------------------
% TODO: Write the function body below
% Note: Recall that the Newton-Raphson method requires an initial guess.
% Choose an initial guess yourself.
f = @(x) _________________;
end
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
