Skip to content

Commit da87a1a

Browse files
committed
correction in Xtrue
Xtrue shows the actual state of the system without addition of noise Xhistory shows the predicted output
1 parent bc568aa commit da87a1a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ExtendedKF.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@
5252
self.vk = sqrt(self.statecovariance)*randn(self.state_dim(1), 1);
5353
%create noisy plant state: REFERENCE VALUE
5454
xtrue_last = self.Xtrue(:, end);
55-
self.xk = self.statetransitionfcn(xtrue_last, self.T) + self.vk;
55+
xtrue = self.statetransitionfcn(xtrue_last, self.T);
56+
self.xk = xtrue + self.vk;
5657

5758
xhat_last = self.Xhistory(:, end);
5859
F = self.statej(xhat_last, self.T);
@@ -63,7 +64,7 @@
6364
self.k = self.k+1;
6465
self.Plast = Ppred;
6566
self.Xhistory(:, self.k) = Xpred;
66-
self.Xtrue(:, self.k) = self.xk;
67+
self.Xtrue(:, self.k) = xtrue;
6768

6869

6970
end

0 commit comments

Comments
 (0)