Constrained minimization problem : fmincon function
18 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Siehe auch
Kategorien
Mehr zu Systems of Nonlinear Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!