Linear Systems. Smith Form

A minimal realization procedure.

pDR={{s^2+3 s+2,-s-2},{0,s+2}}

pNR={{2+s,-1},{s,1}}

col1=Coefficient[pDR[[1;;2,1]],s,2]

col2=Coefficient[pDR[[1;;2,2]],s,1]

pDhc=Transpose[{col1,col2}]

lcol1=Coefficient[pDR[[1;;2,1]],s,0]

lcol2=Coefficient[pDR[[1;;2,1]],s,1]

lcol3=Coefficient[pDR[[1;;2,2]],s,0]

pDl=Transpose[{lcol1,lcol2,lcol3}]

pNl=Partition[Flatten[CoefficientList[pNR,s]],3]

ψ={{1,0},{s,0},{0,1}}

Δ=DiagonalMatrix[{s^2,s}]

Check the result

pDhc.Δ+pDl.ψ

pNl.ψ

mA0=DiagonalMatrix[{1,0},1]

mB0={{0,0},{1,0},{0,1}}

mA=mA0-mB0.Inverse[pDhc].pDl

mB=mB0.Inverse[pDhc]

mC=pNl

tf=Simplify[mC.Inverse[DiagonalMatrix[{s,s,s}]-mA].mB]

tf1=Simplify[pNR.Inverse[pDR]]

Smith form

A test matrix.

tM={{s,s^2},{s+s^3,s^2}}

{tS,tU,tV}=ExtendedSmithForm[tM,s]

MatrixForm[Simplify[tU.tM.tV]]

Compare with the GCD-of-minors definition

Minors[tM,1]

Δ1=Apply[PolynomialGCD,Flatten[Minors[tM,1]]]

This is also the first characteristic polynomial

Δ2=Apply[PolynomialGCD,Flatten[Minors[tM,2]]]

The second characterisitic polynomial

λ2=Δ2/Δ1

A companion matrix example

tA={{0,1,0},{0,0,1},{-a3,-a2,-a1}}

sA=s*IdentityMatrix[3]-tA

MatrixForm[%]

{sfsA,uUA,vVA}=ExtendedSmithForm[sA,s]

MatrixForm[sfsA]

Δ1=Apply[PolynomialGCD,Flatten[Minors[sA,1]]]

Δ2=Apply[PolynomialGCD,Flatten[Minors[sA,2]]]

Δ3=Apply[PolynomialGCD,Flatten[Minors[sA,3]]]

The Smith-McMillan Form

Define a transfer function

mG={{1/(s+1),1/((s+1)(s+2))},{s/((s+1)(s+2)),(2 s+1)/((s+1)(s+2))}}

MatrixForm[%]

The LCM of the denominators

d=(s+1)(s+2)

The numerator matrix

mN=Simplify[d*mG]

The Smith form of the numerator

{mS,mU,mV}=ExtendedSmithForm[mN,s]

The Smith-McMillan form

mcM=Simplify[(1/d)*mS]

eps=Numerator[Diagonal[mcM]]

psi=Denominator[Diagonal[mcM]]

sDl=Expand[DiagonalMatrix[psi].mU]

sNl=Expand[DiagonalMatrix[eps].Inverse[mV]]

Inverse[MatrixForm[sDl]].MatrixForm[sNl]

Simplify[Inverse[sDl].sNl]

Compare with  state spae description

MatrixForm[mA]

MatrixForm[mB]

MatrixForm[mC]

sAc=s*IdentityMatrix[3]-mA

{sAcS,uA,vA}=ExtendedSmithForm[sAc,s]

MatrixForm[sAcS]

SmithForm[sDl]

symat=ArrayFlatten[{{sAc,mB},{-mC,{{0,0},{0,0}}}}]

SmithForm[symat]

SmithForm[sNl]