Failure in initial objective function evaluation. FMINCON cannot continue
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Lokesh Rakawat
il 3 Giu 2018
Commentato: Lokesh Rakawat
il 4 Giu 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 Commenti
Risposta accettata
Walter Roberson
il 3 Giu 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
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Operators and Elementary Operations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!