# plus

Laurent polynomial or Laurent matrix addition

Since R2021b

## Syntax

``Q = plus(A,B)``
``Q = A + B``

## Description

example

````Q = plus(A,B)` returns the sum of the pair of Laurent polynomials or Laurent matrices `A` and `B`. NoteThe `laurentPolynomial` and `laurentMatrix` objects have their own versions of `plus`. The input data type determines which version is executed. ```
````Q = A + B` is equivalent to ```Q = plus(A,B)```.```

## Examples

collapse all

Create two Laurent polynomials:

• $a\left(z\right)={z}^{2}+2z+3+5{z}^{-1}+8{z}^{-2}+13{z}^{-3}$

• $b\left(z\right)=8z+4+2{z}^{-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\left(z\right)$ and $b\left(z\right)$.

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

Add $a\left(z\right)$ and the negative of $b\left(z\right)$.

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

Create two Laurent polynomials:

• $a\left(z\right)=z+1$

• $b\left(z\right)={z}^{2}-{z}^{-1}$

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

Create two Laurent matrices:

• `lmatA` = $\left[\begin{array}{cc}\mathit{a}\left(\mathit{z}\right)& 1\\ 1& 0\end{array}\right]$

• `lmatB` = $\left[\begin{array}{cc}0& 2\\ 3& \mathit{b}\left(\mathit{z}\right)\end{array}\right]$

```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.

## Version History

Introduced in R2021b