HOW to use YALMIP's to get jacobian and hessian 's real value ?

65 views
Skip to first unread message

hui hsu

unread,
Dec 20, 2012, 9:25:03 PM12/20/12
to yal...@googlegroups.com
I Just want to use YALMIP for solving the Jacobian matrix and hessian matrix,

my programs are as follow:

un=5;
A=[1 2 3 4 5]';
B=[5 6 7 8 9]';
C=[3 4 6 7 8]';

P=sdpvar(un,1);
object=sum(A.*P.*P+B.*P+C);
sdisplay(jacobian(object,P))
sdisplay(hessian(object,P))


where 'un' is unknown to us  unless the programs start run.
Symbolic is good but i want the jacobian(object,P)  where P=[1,2,3,4,5]
I try to use assign but failed,It seems it cannot assign a vector
and how can i archive that?

  



hui hsu

unread,
Dec 21, 2012, 12:06:03 AM12/21/12
to yal...@googlegroups.com
Well , I SOLVED IT 

i use 
for i=1:5
    assign(U(i,1),1)
end

and It works

Johan Löfberg

unread,
Dec 21, 2012, 2:08:10 AM12/21/12
to yal...@googlegroups.com
Exactly, except assign(U,1) is easier.

Note though, the jacobian operator is very limited, it only works on purely polynomial expressions. It is not in any sense related to the internal machinery used to supply derivatives to nonlinear solvers on general nonlinear programs.
Reply all
Reply to author
Forward
0 new messages