吴爱国.系统辨识讲义
丁峰.系统辨识新论
最近看完了系统辨识课程的讲义,总结一下讲义上的内容:
系统辨识分为系统结构辨识和系统参数辨识。课程的内容是系统参数的辨识,即假设系统结构已知。
辨识的四要素:输入输出数据,模型集,准则函数,优化方法。
课程中模型的结构已知,实际的辨识中会存在多个可能的模型结构,构成待辨识的模型集。
A ( z ) = 1 + a 1 z − 1 + a 2 z − 2 + . . . . . + a n a z − n a A(z)=1+a_1z^{-1}+a_2z^{-2}+.....+a_{n_a}z^{-n_a} A(z)=1+a1z−1+a2z−2+.....+anaz−na B ( z ) = b 1 z − 1 + b 2 z − 2 + . . . . . + b n b z − n b B(z)=b_1z^{-1}+b_2z^{-2}+.....+b_{n_b}z^{-n_b} B(z)=b1z−1+b2z−2+.....+bnbz−nb C ( z ) = 1 + c 1 z − 1 + c 2 z − 2 + . . . . . + c n c z − n c C(z)=1+c_1z^{-1}+c_2z^{-2}+.....+c_{n_c}z^{-n_c} C(z)=1+c1z−1+c2z−2+.....+cncz−nc D ( z ) = 1 + d 1 z − 1 + d 2 z − 2 + . . . . . + d n d z − n d D(z)=1+d_1z^{-1}+d_2z^{-2}+.....+d_{n_d}z^{-n_d} D(z)=1+d1z−1+d2z−2+.....+dndz−nd F ( z ) = 1 + f 1 z − 1 + f 2 z − 2 + . . . . . + f n f z − n f F(z)=1+f_1z^{-1}+f_2z^{-2}+.....+f_{n_f}z^{-n_f} F(z)=1+f1z−1+f2z−2+.....+fnfz−nf
随机白噪声 v ( t ) v(t) v(t), E ( v ( t ) ) = 0 E(v(t))=0 E(v(t))=0, D ( v ( t ) ) = σ 2 D(v(t))=\sigma^2 D(v(t))=σ2
常用的辨识模型有以下几类:
(1)自回归模型(AR) A ( z ) y ( t ) = v ( t ) A(z)y(t)=v(t) A(z)y(t)=v(t)
该模型表示当前值是过去值的组合。
(2)滑动平均模型(MA) y ( t ) = D ( z ) v ( t ) y(t)=D(z)v(t) y(t)=D(z)v(t)
当前值是过去白噪声的组合。
(3)滑动平均自回归模型(ARMA) A ( z ) y ( t ) = D ( z ) v ( t ) A(z)y(t)=D(z)v(t) A(z)y(t)=D(z)v(t)
(4)确定性模型(ARMA) A ( z ) y ( t ) = B ( z ) u ( t ) A(z)y(t)=B(z)u(t) A(z)y(t)=B(z)u(t)
误差是指描述输入和输出之间的差分方程的误差.
(1)受控自回归模型(ARX) A ( z ) y ( t ) = B ( z ) u ( t ) + v ( t ) A(z)y(t)=B(z)u(t)+v(t) A(z)y(t)=B(z)u(t)+v(t)
(2)受控自回归滑动平均模型(ARMAX) A ( z ) y ( t ) = B ( z ) u ( t ) + D ( z ) v ( t ) A(z)y(t)=B(z)u(t)+D(z)v(t) A(z)y(t)=B(z)u(t)+D(z)v(t)
(3)受控ARAR模型(ARARX) A ( z ) y ( t ) = B ( z ) u ( t ) + v ( t ) / C ( z ) A(z)y(t)=B(z)u(t)+v(t)/C(z) A(z)y(t)=B(z)u(t)+v(t)/C(z)
(4)受控ARARMA模型(ARARMAX) A ( z ) y ( t ) = B ( z ) u ( t ) + D ( z ) C ( z ) v ( t ) A(z)y(t)=B(z)u(t)+\frac{D(z)}{C(z)}v(t) A(z)y(t)=B(z)u(t)+C(z)D(z)v(t)
(1)输出误差模型(OE) y ( t ) = B ( z ) A ( z ) u ( t ) + v ( t ) y(t)=\frac{B(z)}{A(z)}u(t)+v(t) y(t)=A(z)B(z)u(t)+v(t)
(2)输出误差滑动平均模型(OEMA) y ( t ) = B ( z ) A ( z ) u ( t ) + D ( z ) v ( t ) y(t)=\frac{B(z)}{A(z)}u(t)+D(z)v(t) y(t)=A(z)B(z)u(t)+D(z)v(t)
(3)输出误差自回归模型(OEAR) y ( t ) = B ( z ) A ( z ) u ( t ) + 1 C ( z ) v ( t ) y(t)=\frac{B(z)}{A(z)}u(t)+\frac{1}{C(z)}v(t) y(t)=A(z)B(z)u(t)+C(z)1v(t)
(4)输出误差自回归滑动平均模型(OEARMA) y ( t ) = B ( z ) A ( z ) u ( t ) + D ( z ) C ( z ) v ( t ) y(t)=\frac{B(z)}{A(z)}u(t)+\frac{D(z)}{C(z)}v(t) y(t)=A(z)B(z)u(t)+C(z)D(z)v(t)
为了辨识系统参数,一般把系统的参数写成一个参数向量形式,输入输出写成一个信息向量形式,就得到系统的辨识模型,也称为辨识表达式.一般单输入单输出线性参数系统的辨识模型可以表达为: y ( t ) = φ T ( t ) θ + v ( t ) y(t)=\varphi^T(t)\theta+v(t) y(t)=φT(t)θ+v(t)
以一个典型的受控自回归模型为例:
设系统的模型为 y ( t ) + a 1 y ( t − 1 ) + a − 2 y ( t − 2 ) = b 1 u ( t ) + b 2 u ( t − 1 ) + v ( t ) y(t)+a_1y(t-1)+a-2y(t-2)=b_1u(t)+b_2u(t-1)+v(t) y(t)+a1y(t−1)+a−2y(t−2)=b1u(t)+b2u(t−1)+v(t)
将其写为如下的形式: y ( t ) = − a 1 y ( t − 1 ) − a 2 y ( t − 2 ) + b 1 u ( t ) + b 2 u ( t − 1 ) + v ( t ) y(t)=-a_1y(t-1)-a_2y(t-2)+b_1u(t)+b_2u(t-1)+v(t) y(t)=−a1y(t−1)−a2y(t−2)+b1u(t)+b2u(t−1)+v(t)
设观测的数据长度为t,对这个模型有: y ( 3 ) = − a 1 y ( 2 ) − a 2 y ( 1 ) + b 1 u ( 3 ) + b 2 u ( 2 ) + v ( 3 ) y(3)=-a_1y(2)-a_2y(1)+b_1u(3)+b_2u(2)+v(3) y(3)=−a1y(2)−a2y(1)+b1u(3)+b2u(2)+v(3) y ( 4 ) = − a 1 y ( 3 ) − a 2 y ( 2 ) + b 1 u ( 4 ) + b 2 u ( 3 ) + v ( 4 ) y(4)=-a_1y(3)-a_2y(2)+b_1u(4)+b_2u(3)+v(4) y(4)=−a1y(3)−a2y(2)+b1u(4)+b2u(3)+v(4) . . . . . . . . . . . . . . . ............... ............... y ( t ) = − a 1 y ( t − 1 ) − a 2 y ( t − 2 ) + b 1 u ( t ) + b 2 u ( t − 1 ) + v ( t ) y(t)=-a_1y(t-1)-a_2y(t-2)+b_1u(t)+b_2u(t-1)+v(t) y(t)=−a1y(t−1)−a2y(t−2)+b1u(t)+b2u(t−1)+v(t)
令 Y = [ y ( 3 ) , y ( 4 ) . . . . y ( t ) ] T Y=[y(3),y(4)....y(t)]^T Y=[y(3),y(4)....y(t)]T φ T ( i ) = [ − y ( i − 1 ) , − y ( i − 2 ) , u ( i ) , u ( i − 1 ) ] \varphi^T(i)=[-y(i-1),-y(i-2),u(i),u(i-1)] φT(i)=[−y(i−1),−y(i−2),u(i),u(i−1)] θ = [ a 1 , a 2 , b 1 , b 2 ] \theta=[a_1,a_2,b_1,b_2] θ=[a1,a2,b1,b2] H = [ φ ( 3 ) , φ ( 4 ) , . . . . . φ ( t ) ] T H=[\varphi(3),\varphi(4),.....\varphi(t)]^T H=[φ(3),φ(4),.....φ(t)]T V = [ v ( 3 ) , v ( 4 ) . . . . v ( t ) ] T V=[v(3),v(4)....v(t)]^T V=[v(3),v(4)....v(t)]T
我们可以得到: Y = H θ + V Y=H\theta+V Y=Hθ+V
令准则函数为 J ( θ ) = ( Y − H θ ) T ( Y − H θ ) J(\theta)=(Y-H\theta)^T(Y-H\theta) J(θ)=(Y−Hθ)T(Y−Hθ)
J J J对 θ \theta θ求偏导,并令其偏导数为零.得到 θ \theta θ的估计值 θ L S = ( H T H ) − 1 H T Y \theta_{LS}=(H^TH)^{-1}H^TY θLS=(HTH)−1HTY
已知 θ \theta θ的最小二乘估计 θ L S = ( H T H ) − 1 H T Y \theta_{LS}=(H^TH)^{-1}H^TY θLS=(HTH)−1HTY,辨识模型可以写成: Y = H θ + W Y=H\theta+W Y=Hθ+W, W W W代表任意形式的噪声.在这里先不考虑 W W W中未知参数的辨识,只考虑与输入和输出(可测)有关的待估计参数.
则 θ L S \theta_{LS} θLS的数学期望 E ( θ L S ) = E [ ( H T H ) − 1 H T Y ] E(\theta_{LS})=E[(H^TH)^{-1}H^TY] E(θLS)=E[(HTH)−1HTY] = E [ ( H T H ) − 1 H T ( H θ + W ) ] θ =E[(H^TH)^{-1}H^T(H\theta+W)]\theta =E[(HTH)−1HT(Hθ+W)]θ = E [ θ + ( H T H ) − 1 H T W ] =E[\theta+(H^TH)^{-1}H^TW] =E[θ+(HTH)−1HTW] = θ + E [ ( H T H ) − 1 H T W ] =\theta+E[(H^TH)^{-1}H^TW] =θ+E[(HTH)−1HTW]其中 ( H T H ) − 1 H T 为 常 数 (H^TH)^{-1}H^T为常数 (HTH)−1HT为常数,所以 E ( θ L S ) = θ + ( H T H ) − 1 H T E [ W ] E(\theta_{LS})=\theta+(H^TH)^{-1}H^TE[W] E(θLS)=θ+(HTH)−1HTE[W]当 W W W为白噪声,则 E ( θ L S ) = θ E(\theta_{LS})=\theta E(θLS)=θ. E ( θ L S ) E(\theta_{LS}) E(θLS)为 θ \theta θ的无偏估计.
或当噪声向量 W W W的均值为0,且与 H H H无关时, E ( θ L S ) E(\theta_{LS}) E(θLS)为 θ \theta θ的无偏估计.
对一个系统 Y = H θ + W Y=H\theta+W Y=Hθ+W,设噪声向量 W W W的均值为零,协方差矩阵 c o v [ W ] = R v cov[W]=R_v cov[W]=Rv,且 W W W与 H H H相互独立,则参数估计误差 θ L S ~ = θ L S − θ \tilde{\theta_{LS}}=\theta_{LS}-\theta θLS~=θLS−θ的协方差矩阵为 c o v [ θ L S ~ ] = E [ ( H T H ) − 1 H T R v H ( H T H ) − 1 ] cov[\tilde{\theta_{LS}}]=E[(H^TH)^{-1}H^TR_vH(H^TH)^{-1}] cov[θLS~]=E[(HTH)−1HTRvH(HTH)−1]
c o v [ θ L S ~ ] = σ 2 E [ ( H T H ) − 1 ] cov[\tilde{\theta_{LS}}]=\sigma^2E[(H^TH)^{-1}] cov[θLS~]=σ2E[(HTH)−1]
如果 W W W是一白噪声序列,且其方差为 σ 2 \sigma^2 σ2,则 c o v [ θ L S ~ ] = σ 2 E [ ( H T H ) − 1 ] cov[\tilde{\theta_{LS}}]=\sigma^2E[(H^TH)^{-1}] cov[θLS~]=σ2E[(HTH)−1]
对一个系统 Y = H θ + W Y=H\theta+W Y=Hθ+W,设 W W W和 H H H是统计独立的零均值白噪声向量, W W W的分量为零均值白噪声向量 v ( t ) v(t) v(t),则v(t)的方差 σ 2 \sigma^2 σ2的估计为: σ 2 ^ = J [ θ L S ~ ] t − n , t 充 分 大 时 \hat{\sigma^2}=\frac{J[\tilde{\theta_{LS}}]}{t-n},t充分大时 σ2^=t−nJ[θLS~],t充分大时其中 n : = d i m θ = θ 的 维 数 n:=dim\theta=\theta的维数 n:=dimθ=θ的维数
适用模型
受控自回归模型(ARX): A ( z ) y ( t ) = B ( z ) u ( t ) + v ( t ) A(z)y(t)=B(z)u(t)+v(t) A(z)y(t)=B(z)u(t)+v(t)
将上述模型写为辨识模型的形式: Y = H θ + W Y=H\theta+W Y=Hθ+W
递推最小二乘的算法如下: θ ^ ( t ) = θ ^ ( t − 1 ) + L ( t ) [ y ( t ) − φ T ( t ) θ ^ ( t − 1 ) ] \hat\theta(t)=\hat\theta(t-1)+L(t)[y(t)-\varphi^T(t)\hat\theta(t-1)] θ^(t)=θ^(t−1)+L(t)[y(t)−φT(t)θ^(t−1)] L ( t ) = P ( t − 1 ) φ ( t ) 1 + φ T ( t ) P ( t − 1 ) φ ( t ) L(t)=\frac{P(t-1)\varphi(t)}{1+\varphi^T(t)P(t-1)\varphi(t)} L(t)=1+φT(t)P(t−1)φ(t)P(t−1)φ(t) P ( t ) = [ I − L ( t ) φ T ( t ) ] P ( t − 1 ) , P ( 0 ) = p 0 I P(t)=[I-L(t)\varphi^T(t)]P(t-1),P(0)=p_0I P(t)=[I−L(t)φT(t)]P(t−1),P(0)=p0I φ ( t ) = [ − y ( t − 1 ) , − y ( t − 2 ) . . . . , − y ( t − n a ) , u ( t − 1 ) , u ( t − 2 ) , . . . . . u ( t − n b ) ] \varphi(t)=[-y(t-1) ,-y(t-2)....,-y(t-n_a),u(t-1),u(t-2),.....u(t-n_b)] φ(t)=[−y(t−1),−y(t−2)....,−y(t−na),u(t−1),u(t−2),.....u(t−nb)]
计算顺序如下:
P ( 0 ) − > L ( 1 ) − > θ ^ ( 1 ) − > P ( 1 ) − > L ( 1 ) − > θ ^ ( 2 ) − > . . . . . P(0)->L(1)->\hat\theta(1)->P(1)->L(1)->\hat\theta(2)->..... P(0)−>L(1)−>θ^(1)−>P(1)−>L(1)−>θ^(2)−>.....
其中P(0)一般取 1 0 6 10^6 106数量级.
适用模型
受控自回归模型(ARX): A ( z ) y ( t ) = B ( z ) u ( t ) + v ( t ) A(z)y(t)=B(z)u(t)+v(t) A(z)y(t)=B(z)u(t)+v(t)
将上述模型写为辨识模型的形式: Y = H θ + W Y=H\theta+W Y=Hθ+W.
算法如下:
θ ^ ( t ) = θ ^ ( t − 1 ) + L ( t ) [ y ( t ) − φ T ( t ) θ ^ ( t − 1 ) ] \hat\theta(t)=\hat\theta(t-1)+L(t)[y(t)-\varphi^T(t)\hat\theta(t-1)] θ^(t)=θ^(t−1)+L(t)[y(t)−φT(t)θ^(t−1)] L ( t ) = P ( t − 1 ) φ ( t ) λ + φ T ( t ) P ( t − 1 ) φ ( t ) L(t)=\frac{P(t-1)\varphi(t)}{\lambda+\varphi^T(t)P(t-1)\varphi(t)} L(t)=λ+φT(t)P(t−1)φ(t)P(t−1)φ(t) P ( t ) = 1 λ [ I − L ( t ) φ T ( t ) ] P ( t − 1 ) , P ( 0 ) = p 0 I P(t)=\frac{1}{\lambda}[I-L(t)\varphi^T(t)]P(t-1),P(0)=p_0I P(t)=λ1[I−L(t)φT(t)]P(t−1),P(0)=p0I
λ \lambda λ一般取0.9~1,当 λ \lambda λ取1时即为标准最小二乘算法.
新息: e ( t ) = y ( t ) − φ T ( t ) θ ^ ( t − 1 ) e(t)=y(t)-\varphi^T(t)\hat\theta(t-1) e(t)=y(t)−φT(t)θ^(t−1)
残差: ε ( t ) = y ( t ) − φ T ( t ) θ ^ ( t ) \varepsilon(t)=y(t)-\varphi^T(t)\hat\theta(t) ε(t)=y(t)−φT(t)θ^(t)
e ( t ) = [ 1 + 1 λ φ T ( t ) θ ^ ( t ) ] ε ( t ) e(t)=[1+\frac{1}{\lambda}\varphi^T(t)\hat\theta(t)]\varepsilon(t) e(t)=[1+λ1φT(t)θ^(t)]ε(t)
适用模型
受控自回归模型(ARX): A ( z ) y ( t ) = B ( z ) u ( t ) + v ( t ) A(z)y(t)=B(z)u(t)+v(t) A(z)y(t)=B(z)u(t)+v(t)
将上述模型写为辨识模型的形式: Y = H θ + W Y=H\theta+W Y=Hθ+W.
算法如下:
θ ^ ( t ) = θ ^ ( t − 1 ) + P ( t ) [ φ ( t ) , − φ ( t − p ) ] [ y ( t ) − φ T ( t ) θ ^ ( t − 1 ) , y ( t − p ) − φ T ( t − p ) θ ^ ( t − 1 ) ] T \hat\theta(t)=\hat\theta(t-1)+P(t)[\varphi(t),-\varphi(t-p)][y(t)-\varphi^T(t)\hat\theta(t-1),y(t-p)-\varphi^T(t-p)\hat\theta(t-1)]^T θ^(t)=θ^(t−1)+P(t)[φ(t),−φ(t−p)][y(t)−φT(t)θ^(t−1),y(t−p)−φT(t−p)θ^(t−1)]T Q ( t ) = P ( t − 1 ) − P ( t − 1 ) φ ( t ) φ T ( t ) P ( t − 1 ) 1 + φ T ( t ) P ( t − 1 ) φ ( t ) Q(t)=P(t-1)-\frac{P(t-1)\varphi(t)\varphi^T(t)P(t-1)}{1+\varphi^T(t)P(t-1)\varphi(t)} Q(t)=P(t−1)−1+φT(t)P(t−1)φ(t)P(t−1)φ(t)φT(t)P(t−1) P ( t ) = Q ( t ) + Q ( t ) φ ( t − p ) φ T ( t − p ) Q ( t ) 1 − φ T ( t − p ) Q ( t ) φ ( t − p ) P(t)=Q(t)+\frac{Q(t)\varphi(t-p)\varphi^T(t-p)Q(t)}{1-\varphi^T(t-p)Q(t)\varphi(t-p)} P(t)=Q(t)+1−φT(t−p)Q(t)φ(t−p)Q(t)φ(t−p)φT(t−p)Q(t)
适用模型
受控自回归模型(ARX): A ( z ) y ( t ) = B ( z ) u ( t ) + v ( t ) A(z)y(t)=B(z)u(t)+v(t) A(z)y(t)=B(z)u(t)+v(t)
将上述模型写为辨识模型的形式: Y = H θ + W Y=H\theta+W Y=Hθ+W.
θ ^ ( t ) = α ( t − 1 ) + P ( t ) φ ( t ) [ y ( t ) − φ T ( t ) α ( t − 1 ) ] \hat\theta(t)=\alpha(t-1)+P(t)\varphi(t)[y(t)-\varphi^T(t)\alpha(t-1)] θ^(t)=α(t−1)+P(t)φ(t)[y(t)−φT(t)α(t−1)] P ( t ) = 1 λ [ P α ( t − 1 ) − P α ( t − 1 ) φ ( t ) φ T ( t ) P α ( t − 1 ) λ + φ T ( t ) P α ( t − 1 ) φ ( t ) ] P(t)=\frac{1}{\lambda}[P_{\alpha}(t-1)-\frac{P_{\alpha}(t-1)\varphi(t)\varphi^T(t)P_\alpha(t-1)}{\lambda+\varphi^T(t)P_{\alpha}(t-1)\varphi(t)}] P(t)=λ1[Pα(t−1)−λ+φT(t)Pα(t−1)φ(t)Pα(t−1)φ(t)φT(t)Pα(t−1)] α ( t − 1 ) = θ ^ ( t − 1 ) − λ p − 1 P α ( t − 1 ) φ ( t − p ) [ y ( t ) − φ T ( t − p ) θ ^ ( t − 1 ) ] \alpha(t-1)=\hat\theta(t-1)-\lambda^{p-1}P_{\alpha}(t-1)\varphi(t-p)[y(t)-\varphi^T(t-p)\hat\theta(t-1)] α(t−1)=θ^(t−1)−λp−1Pα(t−1)φ(t−p)[y(t)−φT(t−p)θ^(t−1)] P α ( t − 1 ) = P ( t − 1 ) + P α ( t − 1 ) φ ( t − p ) φ T ( t − p ) P α ( t − 1 ) λ − 1 − φ T ( t − p ) P α ( t − 1 ) φ ( t − p ) P_{\alpha}(t-1)=P(t-1)+\frac{P_{\alpha}(t-1)\varphi(t-p)\varphi^T(t-p)P_\alpha(t-1)}{\lambda^{-1}-\varphi^T(t-p)P_{\alpha}(t-1)\varphi(t-p)} Pα(t−1)=P(t−1)+λ−1−φT(t−p)Pα(t−1)φ(t−p)Pα(t−1)φ(t−p)φT(t−p)Pα(t−1)