Failure in initial objective function evaluation. FMINCON cannot continue
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Lokesh Rakawat
el 3 de Jun. de 2018
Comentada: Lokesh Rakawat
el 4 de Jun. de 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 comentarios
Respuesta aceptada
Walter Roberson
el 3 de Jun. de 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
Más respuestas (0)
Ver también
Categorías
Más información sobre Operators and Elementary Operations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!