# cone

cone is used to define the constraint \(\left \lvert x \right\rvert_2 \leq y\) without invoking the overhead of using the norm operator.

### Syntax

```
c = cone(x,y)
```

### Examples

Constraining the Euclidean norm of a vector to be less than 1 is done with

```
x = sdpvar(n,1);
F = cone(x,1);
```

An alternative form is

```
F = cone([1;x]);
```

Of course, arbitrary complicated constructs are possible, such as constraining the norm of the diagonal to be less than the sum of the off-diagonal terms in a matrix.

```
x = sdpvar(n,n);
F = cone(diag(x),sum(sum(x-diag(diag(x)))))
```

An alternative is to use the norm operator instead (see the examples on nonlinear operators for details)

```
x = sdpvar(n,n);
F = norm(diag(x)) <= sum(sum(x-diag(diag(x))))
```

The benefit of using the cone command is that the overhead in YALMIP is reduced (no convexity analysis is required).

The operator can be used in a vectorized form. The following model

```
x = sdpvar(n,1);
y = sdpvar(n,1);
F = [cone(x,1), cone(y,2)]
```

is equivalent to

```
x = sdpvar(n,1);
y = sdpvar(n,1);
F = [cone([1 2;
x y])]
```

## Leave a Comment