Connecting a model to a Kalman filter or extended Kalman filter

4 ビュー (過去 30 日間)
Learning
Learning 2022 年 11 月 5 日
コメント済み: Rajiv Singh 2023 年 5 月 30 日
Hi, how do I connect a model, e.g a polynomial model identified from system identification toolbox to a Kalman filter in Simulink? What are the statetransitionfcn and the measurementfcn? Any example? Thank you!

採用された回答

Rajiv Singh
Rajiv Singh 2022 年 11 月 7 日
Suppose your starting point is a linear model, SYS, identified using an offline identification routine such as TFEST, SSEST, ARMAX, etc. Follow these steps:
  1. Extract state-space data from the model using the IDSSDATA command, [A,B,C,D,K] = idssdata(SYS)
  2. In the Kalman filter block, check the "Use G and H matrices" checkbox.
  3. In the Kalman filter block, set A, B, C, D matrices. Also set Q = SYS.NoiseVariance, R = N = 0. Also set G = K and H = eye(ny), where ny = size(C,1).
If you are using the identified linear model is an Extended Kalman Filter, Unscented Kalman Filter or a Particle Filter block:
Create a MATLAB function file that returns the state update x(t+1) as a function of the current state x(t) and input u(t) as follows:
%-------------------------------
function dx = stateFcn(x,u,A,B)
% state transition fcn
dx = A*x + B*u;
end
%-------------------------------
Similarly, write a function that returns the output as a function of the current state and input values:
%-------------------------------
function y = measurementFcn(x,u,C,D)
% measurement function
y = C*x + D*u;
end
%-------------------------------
In the block, set the state transition function to stateFcn, and the measurement function to measurementFcn. Make sure these functions are on MATLAB path.
  2 件のコメント
Learning
Learning 2022 年 11 月 10 日
Thank you for your response! Question: from a block layout standpoint in Simulink, how would it look like? Do I connect the input block as measurements1 in the Extended Kalman filter? Can I just pass the input through a block containing just the ss model and use the output of the ss model as measurement1 in the Extended Kalman filter? In this case what would the measurement function and state transition functions be?
Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeState-Space Control Design and Estimation についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by