Main Content

plus

Laurent polynomial or Laurent matrix addition

Since R2021b

    Description

    Q = plus(A,B) returns the sum of the pair of Laurent polynomials or Laurent matrices A and B.

    Note

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

    example

    Q = A + B is equivalent to Q = plus(A,B).

    Examples

    collapse all

    Create two Laurent polynomials:

    • a(z)=z2+2z+3+5z-1+8z-2+13z-3

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

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

    Add a(z) and b(z).

    c = a+b
    c = 
      laurentPolynomial with properties:
    
        Coefficients: [1 10 7 7 9 13]
            MaxOrder: 2
    
    

    Add a(z) and the negative of b(z).

    d = plus(a,-b)
    d = 
      laurentPolynomial with properties:
    
        Coefficients: [1 -6 -1 3 7 13]
            MaxOrder: 2
    
    

    Create two Laurent polynomials:

    • a(z)=z+1

    • b(z)=z2-z-1

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

    Create two Laurent matrices:

    • lmatA = [a(z)110]

    • lmatB = [023b(z)]

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

    Sum the matrices.

    lmat = lmatA+lmatB;
    lmat.Elements{1,1}
    ans = 
      laurentPolynomial with properties:
    
        Coefficients: [1 1]
            MaxOrder: 1
    
    
    lmat.Elements{1,2}
    ans = 
      laurentPolynomial with properties:
    
        Coefficients: 3
            MaxOrder: 0
    
    
    lmat.Elements{2,1}
    ans = 
      laurentPolynomial with properties:
    
        Coefficients: 4
            MaxOrder: 0
    
    
    lmat.Elements{2,2}
    ans = 
      laurentPolynomial with properties:
    
        Coefficients: [1 0 0 -1]
            MaxOrder: 2
    
    

    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

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

    Extended Capabilities

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

    Version History

    Introduced in R2021b

    See Also

    Functions

    Objects