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

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 Databases Questions!