Alternate way of defining given function using function handle for fmincon
Ältere Kommentare anzeigen
I have an objective function which is of the form J =
where C is a
matrix of arbitrary constants which I have to determine along with 8 other arbitrary constants in the
matrices A and B which appear in constraints and
are known
scalar matrices. I defined this objective function in MATLAB after evaluating the 4 product terms as follows-
where C is a fun =@(x) (x(9)+x(10)+x(11))^2+(x(9)+x(10)-x(11))^2+(x(9)-x(10)+x(12))^2+(x(9)-x(10)-x(12))^2;
where x(9) to x(12) are the 4 arbitrary constants in the matrix C and x(1) to x(8) are the 8 arbitrary constatnts in the matrices A and B. Then after setting
x0 = zeros(1,12);
and writing the constraints in terms of x(1) to x(8), I got all the 12 arbitrary constants x(1) to x(12) using fmincon. Now what I want is to write this objective function without evaluating each term. Is there any way to do the same?
2 Kommentare
Saurabh Madankar
am 18 Feb. 2022
Bearbeitet: Saurabh Madankar
am 18 Feb. 2022
Saurabh Madankar
am 18 Feb. 2022
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Solver Outputs and Iterative Display finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!