MATLAB: Basics of fminsearch to be explained in laymens terms

fminsearch

Could someone explain me in layman's terms this function? For instance, in the example:
X = fminsearch(@sin,3)
Thank you, Gaha

Best Answer

In layman's term, fminsearch tries to find the minima of the function starting with the point given. Like in your case, fminsearch(@sin,3) or fminsearch(@(x) sin(x),3) tries to find the minima for sin function. The output will be the point where the minima is found. As you know, sin has minima at -1, it will find one of those values for x.
It can optimize for multivariable scenario as well. However, in fminsearch, you can not input the bounds for the variables.
Hope this is clear!