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

SVM train and Classification Errors

Try removing the line species = ClassificationSVM(svmStruct,feat,'showplot',true); To learn how to use the resulting SVM, see...

SVM train and Classification Errors

Try removing the line species = ClassificationSVM(svmStruct,feat,'showplot',true); To learn how to use the resulting SVM, see...

22 hours ago | 0

Answered

Question regarding passing input arguments in fmincon

I am not sure that I understand what you mean by "I want to pass ODEs as a constraint to fmincon." What about the ODE solution i...

Question regarding passing input arguments in fmincon

I am not sure that I understand what you mean by "I want to pass ODEs as a constraint to fmincon." What about the ODE solution i...

22 hours ago | 0

Answered

Why are fitcsvm Hyperparameters trained on the whole dataset and used for crossvalidation?

Perhaps I didn't explain well what the example is supposed to be showing. The second "fitting" step that you object to is not fi...

Why are fitcsvm Hyperparameters trained on the whole dataset and used for crossvalidation?

Perhaps I didn't explain well what the example is supposed to be showing. The second "fitting" step that you object to is not fi...

22 hours ago | 0

Answered

How to solve 4 equations with 4 unknowns with bounds?

You set options for fsolve, but then call lsqnonlin. This is a mistake. You do not pass options to the solver. This might be a ...

How to solve 4 equations with 4 unknowns with bounds?

You set options for fsolve, but then call lsqnonlin. This is a mistake. You do not pass options to the solver. This might be a ...

2 days ago | 1

| accepted

Answered

How do I put a series of sum into a function?

I did not try to run your code, but I have several comments. Use the appropriate solver for your objective. For a quadratic obj...

How do I put a series of sum into a function?

I did not try to run your code, but I have several comments. Use the appropriate solver for your objective. For a quadratic obj...

2 days ago | 0

| accepted

Answered

fmincon performance varies when reformulating interval constraint

fmincon is a gradient-based solver, and as such does not work well with discontinuous functions. Locally, it attempts to minimiz...

fmincon performance varies when reformulating interval constraint

fmincon is a gradient-based solver, and as such does not work well with discontinuous functions. Locally, it attempts to minimiz...

2 days ago | 1

| accepted

Answered

Incorrect solution for symmetric problems in fmincon

fmincon is a gradient-based algorithm. When your initial point is [0.5,0.5], the gradient is zero, and fmincon stops, since it i...

Incorrect solution for symmetric problems in fmincon

fmincon is a gradient-based algorithm. When your initial point is [0.5,0.5], the gradient is zero, and fmincon stops, since it i...

2 days ago | 1

| accepted

Answered

How fmincon shifts x0 when it does not strictly satisfy the upper and lower bounds?

I believe that if you get this message, then you have made an error. You gave a start point that is infeasible with respect to t...

How fmincon shifts x0 when it does not strictly satisfy the upper and lower bounds?

I believe that if you get this message, then you have made an error. You gave a start point that is infeasible with respect to t...

6 days ago | 1

| accepted

Answered

How to optimize parameters in ODE

Well, depending on what it means to optimize, I suspect that you can. I mean, are you trying to maximize a final value of one of...

How to optimize parameters in ODE

Well, depending on what it means to optimize, I suspect that you can. I mean, are you trying to maximize a final value of one of...

7 days ago | 0

Answered

How to code a multi-objective mixed integer linear (MILP) programming problem in MATLAB?

You might find this example to be relevant. Instead of using fgoalattain, you can use intlinprog on an objective function that i...

How to code a multi-objective mixed integer linear (MILP) programming problem in MATLAB?

You might find this example to be relevant. Instead of using fgoalattain, you can use intlinprog on an objective function that i...

7 days ago | 1

Answered

Simulate welded beam design optimization problem using Matlab or Simulink

If you can create the geometry somehow, then I believe that the structural mechanics part of Partial Differential Equation Toolb...

Simulate welded beam design optimization problem using Matlab or Simulink

If you can create the geometry somehow, then I believe that the structural mechanics part of Partial Differential Equation Toolb...

7 days ago | 0

Answered

fminunc stopped because it cannot decrease the objective function along the current search direction.

Without running your example, I wonder if you could make two little changes to see if things are OK: Change the initial point t...

fminunc stopped because it cannot decrease the objective function along the current search direction.

Without running your example, I wonder if you could make two little changes to see if things are OK: Change the initial point t...

8 days ago | 0

Answered

Put weight sum in Genetic algorithm

You seem to be mixing up solving a multiobjective problem by using gamultiobj once and solving it by using fmincon repeatedly. ...

Put weight sum in Genetic algorithm

You seem to be mixing up solving a multiobjective problem by using gamultiobj once and solving it by using fmincon repeatedly. ...

8 days ago | 0

Answered

Is it posible to optimize kinetic parameter in following ordinary differential equation?

I think that you would do better to use ode45 to solve your ODE, and use lsqcurvefit to optimize your parameters, as in this exa...

Is it posible to optimize kinetic parameter in following ordinary differential equation?

I think that you would do better to use ode45 to solve your ODE, and use lsqcurvefit to optimize your parameters, as in this exa...

8 days ago | 0

Answered

How to enter a matrix of variables within the linear equality function in genetic algorithm ?

You should not use a genetic algorithm to solve this equation. Instead, use lsqnonlin, which accepts bound constraints. Alan We...

How to enter a matrix of variables within the linear equality function in genetic algorithm ?

You should not use a genetic algorithm to solve this equation. Instead, use lsqnonlin, which accepts bound constraints. Alan We...

9 days ago | 0

Answered

Invalid value for OPTIONS parameter PopInitRange: must be an array of finite doubles with two rows.

Are you performing a multiobjective optimization? If not, then your fitness function should return a scalar, not two outputs. If...

Invalid value for OPTIONS parameter PopInitRange: must be an array of finite doubles with two rows.

Are you performing a multiobjective optimization? If not, then your fitness function should return a scalar, not two outputs. If...

12 days ago | 0

Answered

How to give constraint of an interger to 'gamultiobj'?

Sorry, gamultiobj does not accept integer constraints. Alan Weiss MATLAB mathematical toolbox documentation

How to give constraint of an interger to 'gamultiobj'?

Sorry, gamultiobj does not accept integer constraints. Alan Weiss MATLAB mathematical toolbox documentation

12 days ago | 0

| accepted

Answered

How is "feasibility" defined in fmincon?

Or see the documentation of iterative display for fmincon. Alan Weiss MATLAB mathematical toolbox documentation

How is "feasibility" defined in fmincon?

Or see the documentation of iterative display for fmincon. Alan Weiss MATLAB mathematical toolbox documentation

13 days ago | 0

| accepted

Answered

Different optimization methods not working when I change derivative discretization.

I do not understand why you are creating approximate derivatives yourself. fmincon and the other optimization functions perform ...

Different optimization methods not working when I change derivative discretization.

I do not understand why you are creating approximate derivatives yourself. fmincon and the other optimization functions perform ...

14 days ago | 0

Answered

Optimize function with Bayesian Optimization

As clearly stated in the documentation for bayesopt, the function passes a TABLE of values. However, rastriginsfcn expects a 2-D...

Optimize function with Bayesian Optimization

As clearly stated in the documentation for bayesopt, the function passes a TABLE of values. However, rastriginsfcn expects a 2-D...

14 days ago | 0

| accepted

Answered

use of fminunc with more than one variables

Please see the documentation on writing scalar objective functions. If you have Release 2019a, you can also use the problem-bas...

use of fminunc with more than one variables

Please see the documentation on writing scalar objective functions. If you have Release 2019a, you can also use the problem-bas...

19 days ago | 0

Answered

GA violates the linear inequality constraints

You have expressed your constraints as nonlinear inequality constraints, not as linear inequality constraints. If the constraint...

GA violates the linear inequality constraints

You have expressed your constraints as nonlinear inequality constraints, not as linear inequality constraints. If the constraint...

20 days ago | 0

| accepted

Answered

How to set up user-supplied Hessian in fmincon for a minimization problem with nonlinear objective and nonlinear constraint?

For general advice related to this sort of problem, see Converged to an Infeasible Point. Alan Weiss MATLAB mathematical toolb...

How to set up user-supplied Hessian in fmincon for a minimization problem with nonlinear objective and nonlinear constraint?

For general advice related to this sort of problem, see Converged to an Infeasible Point. Alan Weiss MATLAB mathematical toolb...

21 days ago | 0

Answered

genetic algorithm optimisation toolbox

If you have a multiobjective function, then use gamultiobj instead of ga. Alan Weiss MATLAB mathematical toolbox documentation...

genetic algorithm optimisation toolbox

If you have a multiobjective function, then use gamultiobj instead of ga. Alan Weiss MATLAB mathematical toolbox documentation...

21 days ago | 1

| accepted

Answered

How to solve an optimization problem with stability constraints using 'fmincon'?

Perhaps this example will give you some ideas. It is written as a multiobjective problem, but you can adapt the code easily to s...

How to solve an optimization problem with stability constraints using 'fmincon'?

Perhaps this example will give you some ideas. It is written as a multiobjective problem, but you can adapt the code easily to s...

22 days ago | 1

Answered

I have a time series of monthly log returns, and want to transform these into monthly log prices. How do I proceed?

doc cumsum Alan Weiss MATLAB mathematical toolbox documentation

I have a time series of monthly log returns, and want to transform these into monthly log prices. How do I proceed?

doc cumsum Alan Weiss MATLAB mathematical toolbox documentation

23 days ago | 0

Answered

Bayesopt: min observed objective not decreasing

Take a look at the note in the documentation of Coupled Constraints. Alan Weiss MATLAB mathematical toolbox documentation

Bayesopt: min observed objective not decreasing

Take a look at the note in the documentation of Coupled Constraints. Alan Weiss MATLAB mathematical toolbox documentation

23 days ago | 0

Answered

Plotting ga custom plot with additional inputs (calculated parameters )

When you create an anonymous function to pass extra parameters, the parameters that are available in the nested function are the...

Plotting ga custom plot with additional inputs (calculated parameters )

When you create an anonymous function to pass extra parameters, the parameters that are available in the nested function are the...

23 days ago | 0

Answered

Find specific point in unknown "function"

The most efficient way is to use fzero as Torsten said. Your function is @(x)y(x)-1. For the most efficiency, set the initial po...

Find specific point in unknown "function"

The most efficient way is to use fzero as Torsten said. Your function is @(x)y(x)-1. For the most efficiency, set the initial po...

26 days ago | 2

| accepted

Answered

GA calculates wrong penalty

To answer your second question first, if you set a problem structure as documented then you can call ga by [x,fval] = ga(proble...

GA calculates wrong penalty

To answer your second question first, if you set a problem structure as documented then you can call ga by [x,fval] = ga(proble...

29 days ago | 0

| accepted