# Kronecker Decomposition

#### TransferFunctionModel supports improper transfer functions. When converted to the time domain, an improper transfer function creates a descriptor StateSpaceModel. The proper and polynomial parts of the transfer function can be decoupled in the state-space model with KroneckerModelDecomposition.

 In[1]:= X{poly, proper} = {Subscript[a, 2] s^2 + Subscript[a, 1] s + Subscript[ a, 0], (k (s - Subscript[z, 1]))/((Subscript[\[Tau], 1 ] s + 1) (Subscript[\[Tau], 2 ] s + 1))};
 In[2]:= Xtfm = TransferFunctionModel[poly + proper, s];
 In[3]:= Xssm = Simplify@Last@KroneckerModelDecomposition[StateSpaceModel[tfm]]
 Out[3]=

#### The descriptor matrix is block diagonal with an identity matrix for the states of the proper subsystem and a nilpotent matrix for the states of the polynomial subsystem.

 In[4]:= XSimplify@TransferFunctionModel[ SystemsModelExtract[ssm, All, All, 1 ;; 2], s]
 Out[4]=
 In[5]:= XTransferFunctionModel[SystemsModelExtract[ssm, All, All, 3 ;; 5], s]
 Out[5]=

#### The solution to the full system is the sum of the solutions to the two parts.

 In[6]:= Xparams = {k -> 1.5, Subscript[\[Tau], 1] -> 1/10, Subscript[\[Tau], 2] -> 1/4, Subscript[z, 1] -> 1, Subscript[a, 2] -> 1, Subscript[a, 1] -> 1, Subscript[a, 0] -> 2};
 In[7]:= Xpolyresponse = OutputResponse[TransferFunctionModel[poly, s], Sin[t], t]; properresponse = OutputResponse[TransferFunctionModel[proper, s], Sin[t], t]; totalresponse = OutputResponse[ssm, Sin[t], t];
 In[8]:= XSimplify[polyresponse + properresponse - totalresponse]
 Out[8]=
 In[9]:= XPlot[Evaluate[{polyresponse, properresponse, totalresponse} /. params], {t, 0, 20}, PlotLegends -> {"poly", "proper", "total"}]
 Out[9]=