I write documentation for MATLAB mathematical toolboxes, primarily optimization. I have also written documentation for PDE, statistics, symbolic math, and econometrics.

My pre-MathWorks job was with Bell Labs, primarily in mathematical models of data traffic, with a strong interest in parallel computation and in rare events (large deviations).

I do not provide private consulting. If you have a question, please ask on a public forum such as MATLAB Answers.

Answered

Error with Fmincon nonlinear constraint

Try this, as documented: nlcon = @(x)deal([],F); Alan Weiss MATLAB mathematical toolbox documentation

Error with Fmincon nonlinear constraint

Try this, as documented: nlcon = @(x)deal([],F); Alan Weiss MATLAB mathematical toolbox documentation

6 days ago | 2

| accepted

Answered

How to get intlinprog to stop when the answer is good enough?

You can create an intlinprog output function to stop the optimizaiton when the objective function value goes below a set limit s...

How to get intlinprog to stop when the answer is good enough?

You can create an intlinprog output function to stop the optimizaiton when the objective function value goes below a set limit s...

7 days ago | 1

| accepted

Answered

Refining mesh size (by having very small mesh size) close to the semi-circular flaw tip - Maximum Principal Stresses and Maximum Shear Stresses

I really don't know, but it is possible that the legacy function adaptmesh would enable you to perform your calculation to the r...

Refining mesh size (by having very small mesh size) close to the semi-circular flaw tip - Maximum Principal Stresses and Maximum Shear Stresses

I really don't know, but it is possible that the legacy function adaptmesh would enable you to perform your calculation to the r...

12 days ago | 0

Answered

how can i plot this code into a banana solutiongraph?

Perhaps what you are asking relates to this example: https://www.mathworks.com/help/optim/ug/banana-function-minimization.html ...

how can i plot this code into a banana solutiongraph?

Perhaps what you are asking relates to this example: https://www.mathworks.com/help/optim/ug/banana-function-minimization.html ...

12 days ago | 0

Answered

nonlinear optimization constraints problem

I suggest that you ensure that your initial point is feasible, and then insert code into your objective function that first eval...

nonlinear optimization constraints problem

I suggest that you ensure that your initial point is feasible, and then insert code into your objective function that first eval...

12 days ago | 0

Answered

How to set up parameter estimation in fmincon

I'm not sure, but I think what you are asking is how to pass several arguments as control variables, and maybe how to pass extra...

How to set up parameter estimation in fmincon

I'm not sure, but I think what you are asking is how to pass several arguments as control variables, and maybe how to pass extra...

12 days ago | 0

Answered

why fmincon output solver stopped prematurely when nonlinear constraint seems satisfied

As you see from the first line of the Tolerance Details table, fmincon constraint tolerances are relative, meaning they are meas...

why fmincon output solver stopped prematurely when nonlinear constraint seems satisfied

As you see from the first line of the Tolerance Details table, fmincon constraint tolerances are relative, meaning they are meas...

19 days ago | 1

Answered

How to get Lagrange multipliers when using GlobalSearch?

Sorry about that. The only way I know is to rerun fmincon starting from the solution point. It won't take long, and will give yo...

How to get Lagrange multipliers when using GlobalSearch?

Sorry about that. The only way I know is to rerun fmincon starting from the solution point. It won't take long, and will give yo...

20 days ago | 1

Answered

Optimizing function of functions

You could use the approach in Generate and Plot a Pareto Front. Or you could try using a multiobjective solver, if you have a Gl...

Optimizing function of functions

You could use the approach in Generate and Plot a Pareto Front. Or you could try using a multiobjective solver, if you have a Gl...

20 days ago | 0

| accepted

Answered

I've got a problem with optimization and using a variable for exponent

Optimization Toolbox™ does not support general nonlinear integer programming. Use ga or surrogateopt for nonlinear integer progr...

I've got a problem with optimization and using a variable for exponent

Optimization Toolbox™ does not support general nonlinear integer programming. Use ga or surrogateopt for nonlinear integer progr...

1 month ago | 0

| accepted

Answered

Optimization Problem with Fixed Discreet Variables

I am not sure, but this example might be relevant. Good luck, Alan Weiss MATLAB mathematical toolbox documentation

Optimization Problem with Fixed Discreet Variables

I am not sure, but this example might be relevant. Good luck, Alan Weiss MATLAB mathematical toolbox documentation

1 month ago | 0

| accepted

Answered

Feasible solutions in a function with a given product.

You can loop through various ri values and read off the resulting L values. Alan Weiss MATLAB mathematical toolbox documentati...

Feasible solutions in a function with a given product.

You can loop through various ri values and read off the resulting L values. Alan Weiss MATLAB mathematical toolbox documentati...

1 month ago | 1

| accepted

Answered

Traveling Salesman Optimization Problem

You can look at this example. But it is much better to use mixed-integer linear programming, as in this example. Alan Weiss M...

Traveling Salesman Optimization Problem

You can look at this example. But it is much better to use mixed-integer linear programming, as in this example. Alan Weiss M...

1 month ago | 0

| accepted

Answered

How can I add constraint on variable in genetic algorithm which can take both discrete and continuous values.

You can represent this 0-or-in-a-range type of constraint by using an auxiliary variable. Suppose that your variable z can be in...

How can I add constraint on variable in genetic algorithm which can take both discrete and continuous values.

You can represent this 0-or-in-a-range type of constraint by using an auxiliary variable. Suppose that your variable z can be in...

1 month ago | 0

| accepted

Answered

Trying to fit a differential equation to some data using lsqcurvefit but getting bad results

My interpretation of your reported lsqcurvefit result is that the solver agrees that you started with the optimal point. It didn...

Trying to fit a differential equation to some data using lsqcurvefit but getting bad results

My interpretation of your reported lsqcurvefit result is that the solver agrees that you started with the optimal point. It didn...

1 month ago | 0

Answered

How to write objective function for Bayesian Optimization (bayesopt)?

There is an example here: https://www.mathworks.com/help/stats/bayesian-optimization-plot-functions.html#d118e31663 The link y...

How to write objective function for Bayesian Optimization (bayesopt)?

There is an example here: https://www.mathworks.com/help/stats/bayesian-optimization-plot-functions.html#d118e31663 The link y...

1 month ago | 0

Answered

How to avoid points that the genetic optimization cannot compute?

The patternsearch and surrogateopt solvers are robust to this type of failure. I suggest that you give them a try. In particula...

How to avoid points that the genetic optimization cannot compute?

The patternsearch and surrogateopt solvers are robust to this type of failure. I suggest that you give them a try. In particula...

1 month ago | 0

Answered

looking for a solution for an optimization problem

I think that you need to be more careful when trying to follow the example. EITHER use fmincon OR use lsqnonlin, not both. The f...

looking for a solution for an optimization problem

I think that you need to be more careful when trying to follow the example. EITHER use fmincon OR use lsqnonlin, not both. The f...

2 months ago | 0

Answered

Genetic algorithm gives incorrect output

I suggest that you give an initial population consisting of at least one feasible point, meaning a point that gives a non-NaN va...

Genetic algorithm gives incorrect output

I suggest that you give an initial population consisting of at least one feasible point, meaning a point that gives a non-NaN va...

2 months ago | 1

Answered

looking for a solution for an optimization problem

You might find this example relevant. If you have a recent MATLAB version, then look at this example. Alan Weiss MATLAB mathem...

looking for a solution for an optimization problem

You might find this example relevant. If you have a recent MATLAB version, then look at this example. Alan Weiss MATLAB mathem...

2 months ago | 0

| accepted

Answered

Consecutive nested integration (definite/indefinite)

I would try to answer this question by not integrating from 0 to infinity, but instead from 0 to a large value, and then use an ...

Consecutive nested integration (definite/indefinite)

I would try to answer this question by not integrating from 0 to infinity, but instead from 0 to a large value, and then use an ...

2 months ago | 0

Answered

Solutions of genetic algorithm and globalsearch versus fmincon

See Hessian for an explanation of why the fmincon Hessian return is pretty much useless. If you need the Hessian AND the solutio...

Solutions of genetic algorithm and globalsearch versus fmincon

See Hessian for an explanation of why the fmincon Hessian return is pretty much useless. If you need the Hessian AND the solutio...

2 months ago | 0

Answered

How to plot the best individual in GA

I am not sure, but it could be that the disparity in the sizes of your components is to blame. I suggest that you scale the firs...

How to plot the best individual in GA

I am not sure, but it could be that the disparity in the sizes of your components is to blame. I suggest that you scale the firs...

2 months ago | 0

Answered

Problem with fmincon ''number of runs''

fmincon is a gradient-based solver. It attempts to evaluate the gradient of the objective function at each iteration. By default...

Problem with fmincon ''number of runs''

fmincon is a gradient-based solver. It attempts to evaluate the gradient of the objective function at each iteration. By default...

2 months ago | 1

| accepted

Answered

Dose who know about Optimization with Summation objective function?

Maybe you should update fun to remember the entire sum, not just the final one. And maybe you should name your indices. fun = o...

Dose who know about Optimization with Summation objective function?

Maybe you should update fun to remember the entire sum, not just the final one. And maybe you should name your indices. fun = o...

2 months ago | 0

| accepted

Answered

Defining constraints in the Quadratic Programming

You can try setting equal upper and lower bounds for those variables. For example, lb = [3, -inf,5]; ub = [3,inf,5]; sets x(1...

Defining constraints in the Quadratic Programming

You can try setting equal upper and lower bounds for those variables. For example, lb = [3, -inf,5]; ub = [3,inf,5]; sets x(1...

3 months ago | 1

Answered

gamultiobj save the optimum value and population in each generation (iteration)

You can use a custom output function, as in this example, to record the population and Pareto front. In the State Structure, the...

gamultiobj save the optimum value and population in each generation (iteration)

You can use a custom output function, as in this example, to record the population and Pareto front. In the State Structure, the...

3 months ago | 0

Answered

Rate constant estimation and optimization (ODE)

You might find this example or this example to be relevant. Alan Weiss MATLAB mathematical toolbox documentation

Rate constant estimation and optimization (ODE)

You might find this example or this example to be relevant. Alan Weiss MATLAB mathematical toolbox documentation

3 months ago | 0

Answered

Undefined function 'prob2struct' for input arguments of type 'sym'

You cannot use symbolic variables directly with Optimization Toolbox™ functions. Either convert your symbolic expressions using ...

Undefined function 'prob2struct' for input arguments of type 'sym'

You cannot use symbolic variables directly with Optimization Toolbox™ functions. Either convert your symbolic expressions using ...

3 months ago | 0

Answered

Optimization Toolbox - Equality Contraint for matrix inputs

You might find that this type of structured constraint is handled most easily using the problem-based approach. See, for example...

Optimization Toolbox - Equality Contraint for matrix inputs

You might find that this type of structured constraint is handled most easily using the problem-based approach. See, for example...

3 months ago | 0