Main Content

minus

Laurent polynomial or Laurent matrix subtraction

Since R2021b

    Description

    example

    Q = minus(A,B) subtracts B from A, where A and B are a pair of Laurent polynomials or Laurent matrices.

    Note

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

    Q = A - B is equivalent to Q = minus(A,B).

    Examples

    collapse all

    Create two Laurent polynomials:

    • a(z)=2z

    • b(z)=8z3+4z2+2z+1

    a = laurentPolynomial(Coefficients=[2],MaxOrder=1);
    b = laurentPolynomial(Coefficients=[8 4 2 1],MaxOrder=3);

    Subtract a(z) from b(z).

    c = minus(b,a)
    c = 
      laurentPolynomial with properties:
    
        Coefficients: [8 4 0 1]
            MaxOrder: 3
    
    

    Subtract a3(z)+a2(z) from b(z).

    d = b-(mpower(a,3)+mpower(a,2))
    d = 
      laurentPolynomial with properties:
    
        Coefficients: [2 1]
            MaxOrder: 1
    
    

    Create the Laurent polynomials:

    • a(z)=5z2+8z+3

    • b(z)=8z+3+2z-1

    lpA = laurentPolynomial(Coefficients=[5 8 3],MaxOrder=2);
    lpB = laurentPolynomial(Coefficients=[8 3 2],MaxOrder=1);

    Create the Laurent matrices:

    • lmatA = [a(z)246]

    • lmatB = [b(z)135]

    lmatA = laurentMatrix(Elements={lpA,2;4,6});
    lmatB = laurentMatrix(Elements={lpB,1;3,5});

    Subtract lmatB from lmatA.

    lmatC = lmatA-lmatB;
    lmatC.Elements{1,1}
    ans = 
      laurentPolynomial with properties:
    
        Coefficients: [5 0 0 -2]
            MaxOrder: 2
    
    
    lmatC.Elements{1,2}
    ans = 
      laurentPolynomial with properties:
    
        Coefficients: 1
            MaxOrder: 0
    
    
    lmatC.Elements{2,1}
    ans = 
      laurentPolynomial with properties:
    
        Coefficients: 1
            MaxOrder: 0
    
    
    lmatC.Elements{2,2}
    ans = 
      laurentPolynomial with properties:
    
        Coefficients: 1
            MaxOrder: 0
    
    

    Input Arguments

    collapse all

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

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

    Output Arguments

    collapse all

    Difference of two Laurent polynomials or two Laurent matrices, returned as a laurentPolynomial object or a laurentMatrix object.

    Extended Capabilities

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

    Version History

    Introduced in R2021b

    See Also

    Functions

    Objects