Community Profile

photo

Alan Weiss

MathWorks

Last seen: Today Active since 2011

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.

Statistics

All
  • Revival Level 3
  • First Submission
  • 36 Month Streak
  • Thankful Level 2
  • Guiding Light
  • Knowledgeable Level 4
  • First Answer
  • Solver

View badges

Content Feed

Answered
Global variables are forbidden in parallel multistart optimization
There are other ways to pass variables other than declariig them as global. See Passing Extra Parameters. Alan Weiss MATLAB ma...

1 day ago | 0

Answered
Can I use "xxx.m" file for object function in GA tool
Please report the MATLAB version you are using, such as R2019a. It makes a difference, because, for example, the Optimization ap...

1 day ago | 1

Answered
Hardstop intlinprog & return the current solutions
You don't have to call prob2struct to solve your problem. Just call [sol,fval] = solve(prob,'Options',opts) Now, what should o...

5 days ago | 0

| accepted

Answered
How can I use lsqcurvefit with a look-up table search as the objective function? Currently, the initial guess always is identified as a local minimum.
To use lsqcurvefit your function needs to be defined and differentiable for continuous values of p. It looks to me as if your fu...

5 days ago | 0

Answered
optimising variables in for loop
It is not clear to me whether you want to minimize q_backup(k) for one particular value of k or for all k from 1 to 145. Genera...

5 days ago | 0

Answered
Fsolve Intemidiate equations result
You could use persistent variables along with assignin to write the variaible value to a workspace variable. Something like this...

5 days ago | 0

Answered
Supplied objective function must return a scalar value
You have a misconception about what linear constraints mean and what a scalar objective function is. Linear constraints do NOT t...

8 days ago | 0

Answered
How to limit optimization program to choose only natural integers numbers (not float) if my objective function is not linear?
If you have Global Optimization Toolbox you can use Mixed Integer ga Optimization. Alan Weiss MATLAB mathematical toolbox docu...

8 days ago | 0

Answered
Why does the fmincon optimization give a slightly different solution in MATLAB 2019B as compared to 2020B?
Many things change in each version. The usual issue is that the underlying math libraries can have slight differences. Optimizat...

8 days ago | 0

Answered
hi, i have a problem with ga function. the problem is: Caused by: Failure in initial user-supplied nonlinear constraint function evaluation.
I believe that the error is here: function [c, ceq] = nlc(x) for j=1:320 c(1) = -sum(x(1,:)) +(320/43.65); ...

8 days ago | 0

| accepted

Answered
optimization of matrices with random initialization
You would probably do well to use the Problem-Based Optimization Workflow. But you can just as easily change your current soluti...

8 days ago | 0

Answered
How can I implement an "if" in optimization problem?
Yoou might be able to find some techniques in the new documentation topic Integer and Logical Modeling. Alan Weiss MATLAB math...

8 days ago | 0

| accepted

Answered
Linear fitting with 2 variables
I think that the Problem-Based Optimization Workflow would help. Write your optimization variables a, b, and c as you have done,...

13 days ago | 1

Answered
replicating excel solver using optimization linprog
I think that you would probably have an easier time formulating your problem by using the Problem-Based Optimization Workflow. ...

14 days ago | 0

Answered
problem using GA to optimize an image processing index in MATLAB?
I suspect that the problem is your objective function takes too long, possibly it does not even finish. I assume that you have ...

14 days ago | 0

Answered
Trying to solve Bethe equations - system of non linear equations
You are the unfortunate victim of a naming discrepancy. The fsolve you linked is for Optimization Toolbox, not Symbolic Math sym...

15 days ago | 0

Answered
How to use ObjectiveCutOff and ObjectiveImprovementThreshold from optimoptions in solver-based optimization problems
I think that you have a mistaken view of what these options do. Consult the options to see what they really do. I don't think th...

15 days ago | 0

| accepted

Answered
Error using ofun Too many input arguments.
I cannot reproduce your issue. When I try the following, I do not get an error: x = randn(20,1); r = ofun(x) function f = o...

16 days ago | 0

Answered
How to fit a generate polynomial coefficients of with general requirements
I could be wrong, but it sounds to me as if the Problem-Based Optimization Workflow would work well for you. You do not have an ...

16 days ago | 0

Answered
How to fit a function to 2D array when some parts of the underlaying function are known?
Well, it depends what you mean by "Z is proportional to c/X and Z is proportional to c2 + c3Y + c4Y^2". You could mean that Z is...

19 days ago | 0

| accepted

Answered
Relation between population size and function count for genetic algorithm
The answer is that some population members are "elite," and they do not have to be evaluated again. See How the Genetic Algorith...

19 days ago | 0

| accepted

Answered
Working of PSO with hybrid function
It means the hybrid function runs after particleswarm stops. Ends. Is done. That's what terminates means. In fact, it is equival...

21 days ago | 1

| accepted

Answered
Minimization and Optimization. Minimize output by optimizing inputs
Sounds like you would be best served with the Problem-Based Optimization Workflow. Declare the variables that can change as opti...

21 days ago | 0

| accepted

Answered
Unable to perform assignment because the size of the left side is 1-by-14 and the size of the right side is 14-by-14.
The error statement is clear: your assignment (equality) statement has a 1-by-14 vector on the left and a 14-by-14 matrix on the...

21 days ago | 0

Answered
fmincon is returning some garbage values in the final output
When I run your script I get the same results as you, so thank you for including all the relevant information. Note that your c...

21 days ago | 0

Answered
(OPTIMIZATION) Initial point is a local minimum - PROBLEM!!
I suggest that you plot the square of the objective function over a reasonable range of the parameter and over a small range suc...

23 days ago | 0

| accepted

Answered
solve a set of two linear equations
I don't really understand what you are trying to do, but it sounds to me like your best bet is to use the Problem-Based Optimiza...

24 days ago | 0

Answered
Solve taking too long, how to optimize code?
Another point of view in case Matt's solution is not satisfactory: work completely in floating point computation rather than sym...

1 month ago | 0

Answered
Refreshment of the objective function with FMINCON
I think that you have a mistaken view of what fmincon does. All optimization solvers take a fixed objective function and iterate...

1 month ago | 1

Answered
Optimisation: minimise function while maximising a design variable
Perhaps you can change the optimization in a nearly unnoticeable way that would bias solutions to have large values of R, like t...

1 month ago | 2

Load more