Question
Please I need help with this Matlab code. Thanks script name: gs_max Calling syntax xstar = gs_max(fhandle, xlb, xub) xstar = gs_max(fhandle, xlb, xub, TolX)
Please I need help with this Matlab code. Thanks
script name: gs_max
Calling syntax
xstar = gs_max(fhandle, xlb, xub) xstar = gs_max(fhandle, xlb, xub, TolX) [xstar, fval] = gs_max(...)
INPUT ARGUMENTS
fhandle - function function to be maximized, f(x).
xlb - scalar - Lower bound of search domain
xub - scalar - Upper bound of search domain TolX - scalar > 0 - Function terminates when (1-R)(xub-xlb/xstar)
Return Arguments:
xstar - scalar - location of maximum
fval - scalar - value of functionn at its maximum
The function should validate that: (if command)
(a) there are at least three inputs,
(b) that the first is a handle to a function (use ~isa(fhandle, 'function_handle')),
(c) that the second two are numeric scalars,
(d) that xlb is smaller than xub, and
(e) that the fourth input, if present, is a positive scalar.
If any of these conditions fail, call error().
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started