Skip to content

Commit

Permalink
Use the right state dimensions all the way through
Browse files Browse the repository at this point in the history
  • Loading branch information
wkearn committed Nov 12, 2014
1 parent a4a4eb5 commit 7e5834d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/augmented.jl
Expand Up @@ -21,17 +21,17 @@ function ap(f::AugmentedUnscentedModel,s::UnscentedState)
n = length(s.x)
(x,p) = augment(s,f.q)
(σn,wm,wc) = sigma(x,p,s.α,s.β,s.κ)
σs = zeros(σn)
xn = zeros(x)
σs = zeros(n,size(σn,2))
xn = zeros(s.x)
for i in 1:size(σn,2)
σs[:,i] = f.f(σn[:,i])
xn += wm[i] * σs[:,i]
end
pn = zeros(p)
pn = zeros(s.p)
for i in 1:size(σn,2)
pn += wc[i] * (σs[:,i]-xn)*(σs[:,i]-xn)'
end
return UnscentedState(xn[1:n],pn[1:n,1:n],s.α,s.β,s.κ)
return UnscentedState(xn,pn,s.α,s.β,s.κ)
end

function covs(kf::AugmentedUnscentedKalmanFilter,y::Observation)
Expand Down
2 changes: 1 addition & 1 deletion test/ukf/augmented.jl
Expand Up @@ -6,7 +6,7 @@ x1,p1 = augment(s,1e-10*eye(2))
zeros(2,2) 1e-10*eye(2)]

function fa(x::Vector)
x1 = zeros(x)
x1 = zeros(2)
x1[1] = x[1] + 0.01*x[2] + x[3]
x1[2] = x[2] - 0.01*x[1] + x[4]
x1
Expand Down

0 comments on commit 7e5834d

Please sign in to comment.