1. Linear Optimization:
The usage of the linprog function. For more information, see help.
2. Nonlinear Optimization:
Fmincon Function
[X, fval, exitflag, output, lambda, grad, Hessian] = fmincon (fun, x0, A, B, aeq, beq, LB, UB, nonlcon, options)
Fun usage
(1) write an equation directly in quotes, for example, '-x (1)-X (2) + 0.5 * x (1)^ 2 + 0.5 * X (2) ^ 2 ';
(2) 'fun ', and then use the function;
(3) @ fun, and then use the function;
(4) @ (x) + equation: for example, @ (x)-x (1)-X (2) + 0.5 * x (1)^ 2 + 0.5 * X (2) ^ 2;
The following noncloon parameters are similar to those of fun.
3. Unrestricted Nonlinear Optimization
Differences between fminbnd, fminunc, and fminsearch
Fminbnd only applies to single variables;
Fminunc can be a single variable or a multi-variable, but can only be a continuous target letter.Number solving;
Fminsearch only supports multiple variables;
Only X is within the real number range.
4. Least Squares Optimization
(1) lsqlin: a straight line from the origin
(2) lsqcurvefut: Evaluate the fitting function containing the variable (X)
(3) lsqnonlin: similar to finding X to minimize the expression
The preceding functions use different optimized mathematical models. For more information, see the mathematical models in the Help file.
In additionAlgorithmThe final result is influential. You can reduce the step size to reduce the error, but it may not be completely error-free.
At the same time, it also avoids some functions that may cause local optimum. The method to avoid this problem can be to draw a picture to see a rough result, and then elaborate on it;
Use multiple functions to solve the problem.Different initial points, genetic algorithms, and lingo