Discrete Kalman Filter Implementation in MATLAB

2 views (last 30 days)
Hi I am trying to implement Discrete Kalman Filter in MATLAB. I am having problem at a couple of steps.
(i) After running a code, I get s.x where x is the state vector (position and velocity of an object). I want to plot position and velocity against time. When I use "plot(t,[s(1:end-1).x],'r.')", I get both position and velocity profiles in one fig. How to plot variables in x separately? Any idea, please!
(ii) I used the following for loop in the code
for t=2:TMAX tru(t,:)=s(t-1).A*tru(t-1,:)'+ s(t-1).B*s(t-1).u+PNstd *randn(2,1); s(t-1).z = s(t-1).H * tru(t,:)' + MNstd*randn(2,1); % create a meas. s(t)=kalmanf(s(t-1)); % perform a Kalman filter iteration detP(t)=s(t).detP; % keep track of "net" uncertainty end
It requires the counter "t" to be a whole number. If I need estimates at points say t=0.1, 0.2, ...., 1.1, 1.2, ...etc, what to do then? When I tries, it gives error that arguments should be positive integers. Don't know how to deal with it. Any idea, please!
Regards
Shah

Answers (0)

Community Treasure Hunt

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

Start Hunting!