Constrained minimization problem : fmincon function
조회 수: 18 (최근 30일)
이전 댓글 표시
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?
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!