Why is the optimization problem solved by lsqnonlin but not by fmincon ?

2 visualizaciones (últimos 30 días)
Hi All,
Equation 1:
Equation 2:
Equation 1 represents the exact dynamics of a system and equation 2 is the approximate dynamics that will give the same time course profiles as equation 1, upon optimization. For the sake of understanding, let us assume eq(1) gives experimental values and equation 2 are the predicted values.
The objective function defined has a cost function that minimizes the difference between state variables ϕ and , by optimizing parameter which are the control variables.
I've set up this problem using fmincon and lsqnonlin. lsqnonlin gives me the optimal solutions but fmincon doesn't. I am not sure if the problem is with the way I have defined the objective function for fmincon.
I'm attaching the code here. Could someone have a look and help me in sorting out the error?
Here are my results,
lsqnonlin
Dhat =
1.0e+03 *
5.0005
5.0002
5.0002
5.0002
4.9997
4.9969
4.9811
4.8900
4.9051
fmincon
First-order Norm of
Iter F-count f(x) Feasibility optimality step
61 620 7.524263e-02 0.000e+00 2.745e-05 9.076e+02
62 630 7.480933e-02 0.000e+00 2.455e-05 1.462e+03
63 640 7.379937e-02 0.000e+00 2.048e-05 2.348e+03
64 650 7.166047e-02 0.000e+00 1.810e-05 3.539e+03
65 660 6.774032e-02 0.000e+00 1.674e-05 4.621e+03
66 670 6.190134e-02 0.000e+00 1.256e-05 4.315e+03
67 680 5.473854e-02 0.000e+00 1.030e-05 1.564e+03
68 690 4.461448e-02 0.000e+00 7.863e-06 4.629e+03
69 701 2.801994e-02 0.000e+00 4.636e-05 1.486e+04
After 69th iteration
Matrix dimensions must agree.
Error in cse_03_19_20/objfun (line 37)
f = (phi - phi_tilde).*(phi - phi_tilde);
Error in barrier
Error in fmincon (line 824)
[X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] = barrier(funfcn,X,A,B,Aeq,Beq,l,u,confcn,options.HessFcn, ...
Error in cse_03_19_20 (line 14)
Dhat = fmincon(@objfun,Dhat0,[],[],[],[],[],[],[], opts)
chnage to make in attached file: line5
solver = struct('lsq',false); while running fmincon and true while running lsqnonlin

Respuestas (0)

Categorías

Más información sobre Nonlinear Optimization en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by