Failure in initial objective function evaluation. FMINCON cannot continue

6 views (last 30 days)
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.

Accepted Answer

Walter Roberson
Walter Roberson on 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

More Answers (0)

Categories

Find more on Operators and Elementary Operations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!