Search code examples
matlabmatrixoptimizationminimization

How to use "fmincon" to solve matrix minimization


Question: How to use "fmincon" to solve the following minimization matrix problem?

I am trying to find the f such that

a * ( b – ( inv(a) * inv(inv(a) + transpose(c)*inv(f)*c) * (inv(a)*d + transpose(c) * inv(f) * e) ) )^2

is minimized subject to:

f > 0

++++Variables:

  • a is (8x8) matrix which is known.
  • b is (8x1) column vector which is known.
  • c is (1x8) column vector which is known.
  • d is (8x1) scalar which is known.
  • e is (1x1) scalar which is known. and
  • f is a scalar and is unknown.

Solution

  • Thanks to the @m7913d, I solved the code via Isqnonlin:

    clc;
    clear all;
    
    % random inputs A, B, C, D and E
    a = rand(8,8)'*rand(8,8);
    b = 2*rand(8,1) - 1;
    c = 2*rand(1,8) - 1;
    d = 2*rand(8,1) - 1;
    e = 2*rand(1,1) - 1;
    
     % minimization term
     fun = @(f) a * ( b - ( inv(a) * inv(inv(a)+c'*inv(f)*c) * (inv(a)*d+c' * inv(f) * e)  ) );
    
    f = lsqnonlin(fun,0.1,0,+inf)