Constrained minimization problem : fmincon function

조회 수: 18 (최근 30일)
Mokhtar Bouain
Mokhtar Bouain 2016년 6월 9일
편집: Matt J 2016년 6월 9일
Hi all,
I want to find a solution to this equation with adding some assumptions:
MATA * Xsol = MATd
where MATA is 1400x12 matrix , MATd is a vector with size 1400
and Xsol =(Xsol(1),Xsol(2),Xsol(3),Xsol(4),Xsol(5),Xsol(6),Xsol(7),Xsol(8),Xsol(9),Xsol(10),Xsol(11),Xsol(12))
I resolved this equation with pinv:
Xsol = pinv(MATAA)*MATd;
But I need some assumptions to add them to my solution. Which are :
dot([ Xsol(1) Xsol(4) Xsol(7)],[ Xsol(2) Xsol(5) Xsol(8)]) =0 ;
dot([ Xsol(1) Xsol(4) Xsol(7)],[ Xsol(3) Xsol(6) Xsol(9)]) =0 ;
dot([ Xsol(3) Xsol(6) Xsol(9)],[ Xsol(2) Xsol(5) Xsol(8)]) =0 ;
So I will use now the fmincon function to solve the constrained minimization problem. First step I get the starting guess with :
Xsol0 = pinv(MATAA)*MATd;
options = optimoptions(@fmincon,'Algorithm','sqp','MaxFunEvals', 3000 );
[Xsol,fval] = fmincon(@objfun,Xsol0,[],[],[],[],[],[],@confun,options);
I define confun.m for the nonlinear constraints.
function [c,ceq] = confun(Xsol)
c=[];
ceq(1)=dot([ Xsol(1) Xsol(4) Xsol(7)],[ Xsol(2) Xsol(5) Xsol(8)]) ;
ceq(2)=dot([ Xsol(1) Xsol(4) Xsol(7)],[ Xsol(3) Xsol(6) Xsol(9)]) ;
ceq(3)=dot([ Xsol(3) Xsol(6) Xsol(9)],[ Xsol(2) Xsol(5) Xsol(8)]);
end
But How can I define my objective function ?? to obtain Xsol with the assumptions ?
function f = objfun(Xsol)
????
?????
end
Any help please?

답변 (1개)

Matt J
Matt J 2016년 6월 9일
편집: Matt J 2016년 6월 9일
Why not a least squares objective as I suggested to you in your previous post on the subject
function fval=objfun(Xsol)
fval=norm( MATA * Xsol - MATd ).^2
end
In the original version of your problem, you are calculating a least squares solution, so why not use a least squares objective function here as well?

카테고리

Help CenterFile Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by