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

How to calculate velocity in PSO CVRP

If you simply want to sort the variables, I suggest that you apply the sort function. nums = [1 4 4 2]; [~,snums] = sort(nums)...

How to calculate velocity in PSO CVRP

If you simply want to sort the variables, I suggest that you apply the sort function. nums = [1 4 4 2]; [~,snums] = sort(nums)...

6 dagar ago | 0

| accepted

Answered

Global Optimization for a Simulink Model

You probably want to minimize the mean squared error. For an example, see lsqnonlin with a Simulink® Model. You can change the s...

Global Optimization for a Simulink Model

You probably want to minimize the mean squared error. For an example, see lsqnonlin with a Simulink® Model. You can change the s...

6 dagar ago | 1

| accepted

Answered

fmincon contraints range issue

You simply need two constraints, area_surf < 10 and area_surf > 5. function [c, ceq]= contraints(x) c(2) = area_surf(x) - 10; ...

fmincon contraints range issue

You simply need two constraints, area_surf < 10 and area_surf > 5. function [c, ceq]= contraints(x) c(2) = area_surf(x) - 10; ...

6 dagar ago | 0

Answered

optimization using symbolic toolbox

Your code returns j = (delta^2*t^3)/3 + (eta^2*t^3)/3 + t With this information, the symbolic portion of your problem is d...

optimization using symbolic toolbox

Your code returns j = (delta^2*t^3)/3 + (eta^2*t^3)/3 + t With this information, the symbolic portion of your problem is d...

7 dagar ago | 0

Answered

Optimization tools: handling error output from objective functions

I suggest that you test for unexpected results within your objective function code and handle it appropriately. For example, if ...

Optimization tools: handling error output from objective functions

I suggest that you test for unexpected results within your objective function code and handle it appropriately. For example, if ...

7 dagar ago | 0

Answered

Multi-stage amplifier optimization

I didn't try too run your code, but this line is incorrect syntax: ceq (1) = A(1)*A(2)*A(3)*A(4)*A(5) = 10000; It should be c...

Multi-stage amplifier optimization

I didn't try too run your code, but this line is incorrect syntax: ceq (1) = A(1)*A(2)*A(3)*A(4)*A(5) = 10000; It should be c...

9 dagar ago | 0

Answered

Unable to use for loop in fmincon

You are not passing the value of p into myfun1. What is it supposed to represent in your code? What I mean is, when you write f...

Unable to use for loop in fmincon

You are not passing the value of p into myfun1. What is it supposed to represent in your code? What I mean is, when you write f...

9 dagar ago | 1

| accepted

Answered

Bayesian optimization with sum constraint

This sounds like a balls-in-buckets problem. You have up to balls to place into buckets. The occupancy (number of balls) of bu...

Bayesian optimization with sum constraint

This sounds like a balls-in-buckets problem. You have up to balls to place into buckets. The occupancy (number of balls) of bu...

18 dagar ago | 0

Answered

fminsearch, Not enough input arguments.

Next time please give the entire error message by copying and pasting everything in red: Not enough input arguments. Error i...

fminsearch, Not enough input arguments.

Next time please give the entire error message by copying and pasting everything in red: Not enough input arguments. Error i...

18 dagar ago | 0

Answered

Graphing a Multi-Objective Optimization problem

Using your functions (edited versions below), I called gamultiobj as follows: A = [2 1]; b = 2; options = optimoptions('gamul...

Graphing a Multi-Objective Optimization problem

Using your functions (edited versions below), I called gamultiobj as follows: A = [2 1]; b = 2; options = optimoptions('gamul...

19 dagar ago | 0

Answered

Mixed Integer Linear Programming Problem

You might find the following documentation useful: Investigate Linear Infeasibilities Alan Weiss MATLAB mathematical toolbox ...

Mixed Integer Linear Programming Problem

You might find the following documentation useful: Investigate Linear Infeasibilities Alan Weiss MATLAB mathematical toolbox ...

21 dagar ago | 0

Answered

non-linear optimization with complex constrains

I think that you need to solve two different problems, one assuming w =100, one assuming w = 500. Your objective is discontinuou...

non-linear optimization with complex constrains

I think that you need to solve two different problems, one assuming w =100, one assuming w = 500. Your objective is discontinuou...

24 dagar ago | 0

Answered

How To Optimize Model Parameters In Simulink?

Perhaps these examples are relevant: Fit ODE, Problem-Based Fit an Ordinary Differential Equation (ODE) Optimizing a Simulati...

How To Optimize Model Parameters In Simulink?

Perhaps these examples are relevant: Fit ODE, Problem-Based Fit an Ordinary Differential Equation (ODE) Optimizing a Simulati...

24 dagar ago | 1

| accepted

Answered

plot the final value of optimization

It seems that your data is x(i) and y(i), and the associated 2*a+3 and 4*b+9. Yeah, they are all constants, nothing much to plot...

plot the final value of optimization

It seems that your data is x(i) and y(i), and the associated 2*a+3 and 4*b+9. Yeah, they are all constants, nothing much to plot...

24 dagar ago | 0

| accepted

Answered

Multiobjective Genetic algorithm with integer variables

Sorry, currently there is no built-in function to perform integer-constrained multiobjective optimization. Alan Weiss MATLAB m...

Multiobjective Genetic algorithm with integer variables

Sorry, currently there is no built-in function to perform integer-constrained multiobjective optimization. Alan Weiss MATLAB m...

26 dagar ago | 1

Answered

Inverse of a function gives different results than the negative function with fmincon

The problem could be related to a few things, such as numerical stability and the presence of multiple local minima. For numeri...

Inverse of a function gives different results than the negative function with fmincon

The problem could be related to a few things, such as numerical stability and the presence of multiple local minima. For numeri...

26 dagar ago | 0

| accepted

Answered

What is the scale problem in lsqcurvefit optimization?

Check out the lsqcurvefit FiniteDifferenceStepSize option that you set with optimoptions. Alan Weiss MATLAB mathematical toolb...

What is the scale problem in lsqcurvefit optimization?

Check out the lsqcurvefit FiniteDifferenceStepSize option that you set with optimoptions. Alan Weiss MATLAB mathematical toolb...

26 dagar ago | 0

Answered

Optimization fmincon with integral. Results not optimal, what am I doing wrong?

The first-order optimality measure is not that small at the end. I suspect that your problem is a bit sensitive. i see in your c...

Optimization fmincon with integral. Results not optimal, what am I doing wrong?

The first-order optimality measure is not that small at the end. I suspect that your problem is a bit sensitive. i see in your c...

ungefär en månad ago | 0

| accepted

Answered

Linear programming with conditional constraints

I think that you can do this with mixed-integer linear programming. Create auxiliary binary variables y1 and y2. These variables...

Linear programming with conditional constraints

I think that you can do this with mixed-integer linear programming. Create auxiliary binary variables y1 and y2. These variables...

ungefär en månad ago | 0

Answered

Failure in initial objective function evaluation. FSOLVE cannot continue. Please help:(

The error is that fsolve expects just one input argument, and you have many (I count 5 arguments, A_py,A_sy,M_py,M_sy,P_c) : g...

Failure in initial objective function evaluation. FSOLVE cannot continue. Please help:(

The error is that fsolve expects just one input argument, and you have many (I count 5 arguments, A_py,A_sy,M_py,M_sy,P_c) : g...

ungefär en månad ago | 0

Answered

Failure in initial nonlinear constraint function evaluation. FMINCON cannot continue.

You did a good job converting the problem to code. Your only real errors are typos in the nonlinear constraint function. Try thi...

Failure in initial nonlinear constraint function evaluation. FMINCON cannot continue.

You did a good job converting the problem to code. Your only real errors are typos in the nonlinear constraint function. Try thi...

ungefär en månad ago | 0

Answered

Mixed Integer (binary) Non-linear problem

That is way too many variables for ga even if it handled integer equality constraints. I suggest that you would probably be best...

Mixed Integer (binary) Non-linear problem

That is way too many variables for ga even if it handled integer equality constraints. I suggest that you would probably be best...

ungefär en månad ago | 0

Answered

from fminsearch to bayesopt

You are free to use bayesopt, but you will have to change your objective function. For bayesopt you first have to create optimiz...

from fminsearch to bayesopt

You are free to use bayesopt, but you will have to change your objective function. For bayesopt you first have to create optimiz...

ungefär en månad ago | 0

Answered

Mesh Adaptive Direct Search

Before calling patternsearch first set the pseudorandom number generator: rng default % Or any other fixed rng value As for yo...

Mesh Adaptive Direct Search

Before calling patternsearch first set the pseudorandom number generator: rng default % Or any other fixed rng value As for yo...

ungefär en månad ago | 0

Answered

convex function with constant Hessian

Perhaps you are looking for quadprog from Optimization Toolbox™. Alan Weiss MATLAB mathematical toolbox documentation

convex function with constant Hessian

Perhaps you are looking for quadprog from Optimization Toolbox™. Alan Weiss MATLAB mathematical toolbox documentation

ungefär en månad ago | 0

Answered

Optimization of multiple functions for desired output

I am not sure that I understand what you are trying to do. If you have three variables to minimize, well, either you are fortuna...

Optimization of multiple functions for desired output

I am not sure that I understand what you are trying to do. If you have three variables to minimize, well, either you are fortuna...

ungefär en månad ago | 0

Answered

fzero error in fa value

Next time, please give the full error thrown by the function. As it is, I don't know what the error is. I guess that the error ...

fzero error in fa value

Next time, please give the full error thrown by the function. As it is, I don't know what the error is. I guess that the error ...

ungefär en månad ago | 0

Answered

Solving Complex Equations Using "fmincon"

I don't understand why you are trying to use fmincon to solve systems of nonlinear equations. Use fsolve for that. And then you ...

Solving Complex Equations Using "fmincon"

I don't understand why you are trying to use fmincon to solve systems of nonlinear equations. Use fsolve for that. And then you ...

ungefär en månad ago | 0

| accepted

Answered

Mesh Adaptive Direct Search: Problems finding global solution

fmincon is the local solver of choice for smooth problems. patternsearch is NOT guaranteed to get a global solution (no solver i...

Mesh Adaptive Direct Search: Problems finding global solution

fmincon is the local solver of choice for smooth problems. patternsearch is NOT guaranteed to get a global solution (no solver i...

ungefär en månad ago | 0

| accepted

Answered

ga (genetic algorithm) violated linear constraints

I would rescale the problem first. Your x(1), x(2), x(5), and x(6) variables should be multiplied by 1e8 or 1e9, so that they ha...

ga (genetic algorithm) violated linear constraints

I would rescale the problem first. Your x(1), x(2), x(5), and x(6) variables should be multiplied by 1e8 or 1e9, so that they ha...

ungefär en månad ago | 0