Skip to content

nonlinear_pem: pass the sample interval of the data to the UKF - #210

Merged
baggepinnen merged 1 commit into
masterfrom
fb/nonlinear-pem-ts
Nov 21, 2026
Merged

baggepinnen merged 1 commit into
masterfrom
fb/nonlinear-pem-ts

Conversation

@baggepinnen

Copy link
Copy Markdown
Member

nonlinear_pem constructed its UnscentedKalmanFilter without Ts, so the filter used the default Ts = 1. Dynamics or measurement functions that depend on time therefore received t = k instead of t = k*d.Ts, and the estimate was wrong whenever d.Ts ≠ 1. The UKF now receives Ts = d.Ts.

predict(model, d) also passed the sample index 1:length(d) as the time argument of the measurement function. It now passes range(0, step = d.Ts, length = length(d)).

Test

A new testset in test/test_nonlinear_pem.jl uses a first-order model with a known forcing sin(t), Ts = 0.1 and noise-free data.

Check Before After
model.ukf.Ts 1.0 0.1
Estimate of p = [0.8, 1.5] [0.277, 1.399] equal to the truth within rtol = 1e-3
One-step prediction fails atol = 1e-2 passes

The measurement function of the test does not depend on time, so the predict change is not exercised by it. The existing testsets were not run.


Host: demeter2, Claude Code session fb40ab3f-b528-4d68-8420-c82305c52757, working directory scratchpad clone of ControlSystemIdentification.jl

🤖 Generated with Claude Code

The UKF of nonlinear_pem was constructed without Ts, so dynamics and
measurement functions that depend on time received t = k instead of
t = k*d.Ts. predict passed the sample index as the time to the measurement
function; it now passes (k-1)*d.Ts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@baggepinnen
baggepinnen merged commit 5219716 into master Nov 21, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant