Failure in initial objective function evaluation. FMINCON cannot continue
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Lokesh Rakawat
am 3 Jun. 2018
Kommentiert: Lokesh Rakawat
am 4 Jun. 2018
for i=1:3
P_j(:,i) = fmincon(@(X)( X*(k_integ(:,:)*X.') ), P_j0(:,i), [], [], A, Beq(:,i) );
end
I have P_j0 as 52x3, A as 37x52, Beq as 37x3, k_integ as 52x52 (3 for x, y and z) When using fmincon for each i, I get
Error using * Inner matrix dimensions must agree.
Caused by: Failure in initial objective function evaluation. FMINCON cannot continue.
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 3 Jun. 2018
P_j0(:,i) is 52 x 1 and will become X in the anonymous function. You .' it into being 1 x 52. So you have (52 x 1) * (52 x 52) * (1 x 52) which is not valid matrix multiplication.
You can pass in P_j0(:,i).' to be passing in 1 x 52, which would get you (1 x 52) * (52 x 52) * (52 x 1) which would produce 1 x 1
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Operators and Elementary Operations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!