Could I transfer a function file (state space function) to a model so I could forecast it my data

1 回表示 (過去 30 日間)
i want to transformate this function
function [pos vel Px] = DvKalman(z)
%
%
persistent A H Q R
persistent x P
persistent firstRun
if isempty(firstRun)
firstRun = 1;
dt = 1; % sec, for sonar
A = [ 1 dt ;
0 1 ];
H = [1 0];
Q = [ 1 0 ;
0 3 ];
R = 10;
x = [ 0 20 ]';
P = 5*eye(2);
end
% Kalman filter algorithm
xp = A*x;
Pp = A*P*A' + Q;
K = Pp*H'*inv(H*Pp*H' + R);
x = xp + K*(z - H*xp);
P = Pp - K*H*Pp;
pos = x(1);
vel = x(2);
Px = P ;
to a ssm Model
  1 件のコメント
Benjamin Thompson
Benjamin Thompson 2024 年 1 月 27 日
Are you talking about a Simulink model or a State Space Representation of the model in this function?
For a state space model see the documentation on ss and kalman:
doc ss
doc kalman

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeAutomotive についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by