Implementing Kalman Filter using symbolic MATLAB
1 回表示 (過去 30 日間)
古いコメントを表示
Hello all
I have been trying to implement the Kalman filter to predict the values of input x(n) given the observations y(n). According to the text book, the optimal filter weights are given as:
H(z) = G/(1-f*(z^-1))
I have calculated the values of G and f. I also have the vector of observations Y_N.
The difference equation thus comes out to be : x(n) = f*x(n-1) + G*y(n)
I want to plot the estimates x(n) now using SYMBOLIC MATLAB.
Following is my code:
syms z H_Z;
H_Z = G/(1-(f*(z^-1)))
syms Y_Z X_Z n
Y_Z = poly2sym(Y_N,z^-1) %(I am also stuck at this part- how do you calculate the z-transform of a vector. MATLAB refuses to take z^-1 as the symbolic variable)
X_Z = H_Z*Y_Z
x_n = sym2poly(X_Z) %(getting an error here: not a polynomial)
Would anybody please guide me with this problem. If my logic is correct, then any help with syntax would be appreciated.
0 件のコメント
回答 (1 件)
Walter Roberson
2018 年 3 月 28 日
syms zinv
H_Z = G/(1-(f*(zinv)))
Y_Z = subs(poly2sym(Y_N,zinv), zinv, 1/z)
2 件のコメント
Walter Roberson
2018 年 3 月 28 日
even if you
X_Z = subs(H_Z, zinv, 1/z)*Y_Z
then what you get out is not a polynomial and cannot be converted to one. H_Z divides by an expression involving the variable, leading to an expression that cannot be rationalized to be a polynomial. The best you could hope for is a ratio of polynomials. Unfortunately, MATLAB does not make it easy to find out what the ratio consists of.
参考
カテゴリ
Help Center および File Exchange で Symbolic Math Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!