Main Content

uminus

Unary minus for Laurent polynomial or Laurent matrix

Since R2021b

    Description

    Q = uminus(P) negates the Laurent polynomial or the Laurent matrix specified by P. If P is a Laurent matrix, uminus negates the matrix elements.

    Note

    The laurentPolynomial and laurentMatrix objects have their own versions of uminus. The input data type determines which version is executed.

    example

    Q = -P is equivalent to Q = uminus(P).

    Examples

    collapse all

    Create a Laurent polynomial

    a = laurentPolynomial(Coefficients=[-2 6 -7 -2 1],MaxOrder=3);

    Confirm the sum of a(z) and its unary minus is 0.

    au = uminus(a);
    a+au
    ans = 
      laurentPolynomial with properties:
    
        Coefficients: 0
            MaxOrder: 0
    
    

    Create the Laurent polynomials

    • a(z)=z+1

    • b(z)=z2+z+z-1

    • c(z)=z

    • d(z)=z2+z-1

    lpA = laurentPolynomial(Coefficients=[1 1],MaxOrder=1);
    lpB = laurentPolynomial(Coefficients=[1 1 0 1],MaxOrder=2);
    lpC = laurentPolynomial(Coefficients=[1],MaxOrder=1);
    lpD = laurentPolynomial(Coefficients=[1 0 0 1],MaxOrder=2);

    Create the matrix lmat = [a(z)b(z)c(z)d(z)].

    lmat = laurentMatrix(Elements={lpA,lpB;lpC,lpD});

    Confirm the sum of lmat and its unary negative is 0.

    lmatu = uminus(lmat);
    xmat = lmat+lmatu;
    dispMat(xmat)
    | 0.00e+00   0.00e+00 |
    |                     | 
    | 0.00e+00   0.00e+00 |
    

    Input Arguments

    collapse all

    Laurent polynomial or Laurent matrix, specified as a laurentPolynomial object or a laurentMatrix object, respectively.

    Output Arguments

    collapse all

    Negated Laurent polynomial or Laurent matrix, returned as a laurentPolynomial object or a laurentMatrix object. If P is a Laurent polynomial, the coefficients are negated.

    Extended Capabilities

    C/C++ Code Generation
    Generate C and C++ code using MATLAB® Coder™.

    Version History

    Introduced in R2021b

    See Also

    Functions

    Objects