Rev | Line | |
---|
[37] | 1 | function y = cone(Axplusb,cxplusd) |
---|
| 2 | %CONE Defines a second order cone constraint ||z||<x |
---|
| 3 | % |
---|
| 4 | % Input |
---|
| 5 | % z : column vector SDPVAR object. |
---|
| 6 | % h : scalar double or SDPVAR object |
---|
| 7 | % |
---|
| 8 | % Example |
---|
| 9 | % F = set(cone(z,x)) |
---|
| 10 | % |
---|
| 11 | % An alternative syntax with only one argument is also possible |
---|
| 12 | % F = set(cone(z)) |
---|
| 13 | % This command is equivalent to set(cone(z(2:end),z(1)) |
---|
| 14 | % |
---|
| 15 | |
---|
| 16 | % |
---|
| 17 | % See also SET, RCONE, @SDPVAR/NORM |
---|
| 18 | |
---|
| 19 | % Author Johan Löfberg |
---|
| 20 | % $Id: cone.m,v 1.1 2006/08/10 18:00:19 joloef Exp $ |
---|
| 21 | |
---|
| 22 | [n,m] = size(Axplusb); |
---|
| 23 | if min(n,m)>1 |
---|
| 24 | error('z must be a vector') |
---|
| 25 | end |
---|
| 26 | |
---|
| 27 | if nargin == 2 |
---|
| 28 | if prod(size(cxplusd))>1 |
---|
| 29 | error('x must be a scalar') |
---|
| 30 | end |
---|
| 31 | else |
---|
| 32 | end |
---|
| 33 | |
---|
| 34 | if n<m |
---|
| 35 | Axplusb = Axplusb'; |
---|
| 36 | end |
---|
| 37 | |
---|
| 38 | try |
---|
| 39 | if nargin == 2 |
---|
| 40 | y = [cxplusd;Axplusb]; |
---|
| 41 | else |
---|
| 42 | y = [Axplusb]; |
---|
| 43 | end |
---|
| 44 | if is(y,'linear') |
---|
| 45 | y.typeflag = 4; |
---|
| 46 | else |
---|
| 47 | y = (Axplusb'*Axplusb < cxplusd*cxplusd); |
---|
| 48 | end |
---|
| 49 | catch |
---|
| 50 | error(lasterr) |
---|
| 51 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.