Main Content

toCellArray

Convert lag operator polynomial object to cell array

Syntax

[coefficients, lags] = toCellArray(A)

Description

[coefficients, lags] = toCellArray(A) converts a lag operator polynomial object A(L) to an equivalent cell array. coefficients is the cell array equivalent to the lag operator polynomial A(L). lags is a vector of unique integer lags associated with the polynomial coefficients. Elements of lags are in ascending order. The first element of lags is the smaller of the smallest nonzero coefficient lag of the object and zero; the last element of lags is the degree of the polynomial. That is, lags = [min(A.Lags,0), 1, 2, ... A.Degree].

Examples

expand all

Create a LagOp polynomial and convert it to a cell array:

A = LagOp({0.8 1 0 .6});
B = toCellArray(A);
class(B)
ans = 
'cell'

Algorithms

LagOp objects implicitly store polynomial lags and corresponding coefficient matrices of zero-valued coefficients via lag-based indexing. However, cell arrays conform to traditional element indexing rules, and must explicitly store zero coefficient matrices.

The output cell array is equivalent to the input lag operator polynomial in the sense that the same lag operator is created when the output coefficients and lags are used to create a new LagOp object. That is, the following two statements produce the same polynomial A(L):

[coefficients,lags] = toCellArray(A);
A = LagOp(coefficients,'Lags',lags);