Yalmip变量操作
1、Assgin,赋值
Assgin,语法assign(X,Y)
t = sdpvar(1,1);x = [t t];
assign(t,4)
value(x)
x = sdpvar(1,1);
assign(x,pi);
optimize([sin(x)^2 <=0.1,0<=x<=10],x,sdpsettings('usex0',1));
value(x)
2、Coefficients,提取多项式系数
sdpvar x y s t
p = x^2+x*y*(s+t)+s^2+t^2;
[c,v] = coefficients(p,[x y]);
sdisplay([c v])
3、Degree,返回多项式的度
sdpvar x1 x2
f = x1^2*x2^3 + x1^4;
degree(f) %返回总度数
degree(f,[x1 x2]) %分别返回各个degree
degree(x1^2*x2^3 + x1^4,[x1 x2],'min') %返回最小degree
4、Jacobian,求微分
x1 = sdpvar(1,1);
x2 = sdpvar(1,1);
f = x1^2+5*x2^2;
sdisplay(jacobian(f))
sdisplay(jacobian(f,x2))