How to add a constraint function to lsqnonlin

조회 수: 3 (최근 30일)
James Choi
James Choi 2017년 3월 10일
편집: Torsten 2017년 3월 10일
Hello, users.
I'm using Matlab and optimizaiton toolbox to find matrix x. (Please see figure attached.)
Matrix A is m*n matrix which has fixed values and matrix B is output.
I used fmincon to find matrix x when B has (almost) identical values. For this work "fun" is a function of minimizing standard deviation.
At that time I was able to use nonlcon for the condition that maximum x value is smaller than two times of minimum value. (xmax <= 2*xmin)
x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon,options)
But when matrix B has different values, I know I cannot use fmincon anymore.
I'm trying to use lsqnonlin but it does not support constraint function.
x = lsqnonlin(fun,x0,lb,ub,options)
After numerical optimization, there is too big difference maximum value and minimum value. (xmax > 10000*xmin, it's not realistic value.)
Question. Can I get some matlab tip for this work? I mean I want to check if there is some user-subroutine or something other way to handle this.
Thanks in advance.
  댓글 수: 1
Torsten
Torsten 2017년 3월 10일
편집: Torsten 2017년 3월 10일
So your problem is
min: ||A*x-B||
under the constraint
max(x_i) <= 2*min(x_i)
?
Best wishes
Torsten.

댓글을 달려면 로그인하십시오.

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by