Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Reduce the number of fminsearch iterations

Subject: Reduce the number of fminsearch iterations

From: Sonia

Date: 30 Oct, 2013 10:18:18

Message: 1 of 3

Is it possible to make the fminsearch algorithm stop as soon as it evaluates the objective function at a given x as zero?
I am optimizing for one variable and what happens is that the fminsearch finds a point where the objective function f(x) = 0, but it continues to iterate until the simplex is contracted around that value of x that gives 0. I would like it to stop as soon as the fun(x)=0

Subject: Reduce the number of fminsearch iterations

From: Torsten

Date: 30 Oct, 2013 11:23:20

Message: 2 of 3

"Sonia" wrote in message <l4qmda$50k$1@newscl01ah.mathworks.com>...
> Is it possible to make the fminsearch algorithm stop as soon as it evaluates the objective function at a given x as zero?
> I am optimizing for one variable and what happens is that the fminsearch finds a point where the objective function f(x) = 0, but it continues to iterate until the simplex is contracted around that value of x that gives 0. I would like it to stop as soon as the fun(x)=0

Use an output function to make fminsearch stop iterating:
http://www.mathworks.de/de/help/matlab/math/output-functions.html

Best wishes
Torsten.

Subject: Reduce the number of fminsearch iterations

From: Steven Lord

Date: 30 Oct, 2013 13:37:10

Message: 3 of 3


"Torsten " <Torsten.Hennig@umsicht.fraunhofer.de> wrote in message
news:l4qq78$pdt$1@newscl01ah.mathworks.com...
> "Sonia" wrote in message <l4qmda$50k$1@newscl01ah.mathworks.com>...
>> Is it possible to make the fminsearch algorithm stop as soon as it
>> evaluates the objective function at a given x as zero?
>> I am optimizing for one variable and what happens is that the fminsearch
>> finds a point where the objective function f(x) = 0, but it continues to
>> iterate until the simplex is contracted around that value of x that gives
>> 0. I would like it to stop as soon as the fun(x)=0
>
> Use an output function to make fminsearch stop iterating:
> http://www.mathworks.de/de/help/matlab/math/output-functions.html

Or use FZERO or FSOLVE (from Optimization Toolbox) to find a zero of your
function. FZERO will work if your objective function is a function of one
variable; use FSOLVE for functions of more than one variable.

If FZERO or FSOLVE indicate that they weren't able to find a zero of your
function, then you can switch to FMINSEARCH and let it go until it finds a
minimizer for your function.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us