主要内容

创建具有未知参数的状态空间模型

Explicitly Create State-Space Model Containing Unknown Parameters

This example shows how to create a time-invariant, state-space model containing unknown parameter values usingssm.

Define a state-space model containing two dependent MA(1) states, and an additive-error observation model. Symbolically, the equation is

[ x t , 1 x t , 2 x t , 3 x t , 4 ] = [ 0 θ 1 λ. 1 0 0 0 0 0 0 0 0 θ 3 0 0 0 0 ] [ x t - 1 , 1 x t - 1 , 2 x t - 1 , 3 x t - 1 , 4 ] + [ σ. 1 0 1 0 0 σ. 2 0 1 ] [ u t , 1 u t , 2 ]

y t = [ 1 0 0 0 0 0 1 0 ] [ x t , 1 x t , 2 x t , 3 x t , 4 ] + [ σ. 3 0 0 σ. 4 ] [ ε t , 1 ε t , 2 ] .

Note that the states x t , 1 x t , 3 are the two dependent MA(1) processes. The states x t , 2 x t , 4 help construct the lag-one, MA effects. For example, x t , 2 picks up the first disturbance ( u t , 1 ), and x t , 1 picks up x t - 1 , 2 = u t - 1 , 1 . In all, x t , 1 = λ. 1 x t - 1 , 3 + u t , 1 + θ 1 u t - 1 , 1 ,这是马(1) x t - 1 , 3 作为一个输入。

Specify the state-transition coefficient matrix. UseNaNvalues to indicate unknown parameters.

A = [0 NaN NaN 0; 0 0 0 0; 0 0 0 NaN; 0 0 0 0];

Specify the state-disturbance-loading coefficient matrix.

B = [南0;1 0;0楠;0 1];

Specify the measurement-sensitivity coefficient matrix.

C = [1 0 0 0; 0 0 1 0];

指定观察创新系数矩阵。

D = [NaN 0; 0 NaN];

采用ssm定义状态空间模型。

MDL.= ssm(A,B,C,D)
MDL.= State-space model type: ssm State vector length: 4 Observation vector length: 2 State disturbance vector length: 2 Observation innovation vector length: 2 Sample size supported by model: Unlimited Unknown parameters for estimation: 7 State variables: x1, x2,... State disturbances: u1, u2,... Observation series: y1, y2,... Observation innovations: e1, e2,... Unknown parameters: c1, c2,... State equations: x1(t) = (c1)x2(t-1) + (c2)x3(t-1) + (c4)u1(t) x2(t) = u1(t) x3(t) = (c3)x4(t-1) + (c5)u2(t) x4(t) = u2(t) Observation equations: y1(t) = x1(t) + (c6)e1(t) y2(t) = x3(t) + (c7)e2(t) Initial state distribution: Initial state means are not specified. Initial state covariance matrix is not specified. State types are not specified.

MDL.is anssmmodel containing unknown parameters. A detailed summary ofMDL.prints to the Command Window. It is good practice to verify that the state and observations equations are correct.

PassMDL.和data toestimateto estimate the unknown parameters.

隐含地创建时间不变状态空间模型

此示例显示如何通过传递描述模型的参数映射函数来创建时间不变状态空间模型ssm(that is,隐含create a state-space model). The state model is AR(1) model. The states are observed with bias, but without random error. Set the initial state mean and variance, and specify that the state is stationary.

Write a function that specifies how the parameters inparams映射到状态空间模型矩阵,初始状态值和状态类型。

%版权所有2015 The MathWorks,Inc。功能[A,B,C,D,Mean0,Cov0,StateType] = timeInvariantParamMap(params)% Time-invariant state-space model parameter mapping function example. This%函数将Vector Params映射到状态空间矩阵(A,B,C和%d),初始状态值和初始状态方差(平均值和% Cov0), and the type of state (StateType). The state model is AR(1)%没有观察错误。varu1 = exp(Params(2));% Positive variance constrainta = params(1);b = sqrt(varu1);c = params(3);d = [];意思是0 = 0.5;cov0 = 100;stateType = 0;end

将此代码保存为命名的文件timeInvariantParamMapto a folder on your MATLAB® path.

Create the state-space model by passing the functiontimeInvariantParamMapas a function handle tossm.

MDL.= ssm(@timeInvariantParamMap);

The software implicitly defines the state-space model. Usually, you cannot verify state-space models that you implicitly define.

MDL.is anssm含有未知参数的模型对象。你这n estimate the unknown parameters by passingMDL.和response data toestimate.

See Also

||

Related Examples

More About