Implementing Kalman Filter using symbolic MATLAB
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Walter Roberson
el 28 de Mzo. de 2018
syms zinv
H_Z = G/(1-(f*(zinv)))
Y_Z = subs(poly2sym(Y_N,zinv), zinv, 1/z)
2 comentarios
Walter Roberson
el 28 de Mzo. de 2018
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.
Ver también
Categorías
Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!