| # Diagram Shaping via SOCP Antenna Array Design > Physics | Diagram Shaping | Least-Squares Design | SOCP Design Minimum thermal noise power for given sidelobe level Minimum sidelobe level attenuation ## Minimum thermal noise power for given sidelobe level We first seek to minimize the thermal noise power subject to a sidelobe level constraint. This problem can be cast as The above constraints are second-order cone constraints on the decision variables, since they involve magnitude constraints on a complex vector that depends affinely on the decision variables. Hence the above problem is an SOCP. A CVX implementation of this problem is given below. Note that CVX understands the magnitude of a complex variable and transforms the corresponding constraint into a second-order cone one internally. CVX implementation
    cvx_begin
        variable z(n,1) complex;
        minimize( norm(z,2) )
        subject to
            for i = 1:N,
                abs(exp(a*cos(Angles(i))*(1:n))*z) <= delta;
            end
            real( exp(a*(1:n))*z) >= 1;
    cvx_end
For a particular example, we take the same parameters as in the least-squares design. We set the sidelobe level at . Measured in decibels (dB):
| Antenna array design: minimal thermal noise power given a sidelobe level constraint of dB, enforced at points. Due to our coarse discretization, the sidelobe constraints are only enforced at specific angles (in blue), but not everywhere satisfied.
The coarse discretization level of may be an issue. This is readily solved by using a higher number, say .
| Antenna array design: minimal thermal noise power given a sidelobe level constraint, enforced at points. With a finer discretization, the sidelobe constraints are everywhere satisfied.
## Minimum sidelobe level attenuation Our goal is now to minimize the sidelobe attenuation level, , given the normalization requirement . This can be cast as the SOCP A CVX implementation is given below. CVX implementation
    cvx_begin
        variable z(n,1) complex;
        variable delta(1)
        minimize( delta )
        subject to
            for i = 1:N,
                abs(exp(a*cos(Angles(i))*(1:n))*z) <= delta;
            end
            real( exp(a*(1:n))*z) >= 1;
    cvx_end
The result shows an optimal attenuation level in the stop band of , which, in decibels, is:
| Antenna array design: the optimal magnitude diagram. The attenuation is excellent in the stop band, so that the stop-band magnitude is not distinguishable from zero in this plot.
## Trade-off curve