Implementing Kalman Filter using symbolic MATLAB
조회 수: 2 (최근 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!