English
State Estimation

구축 방법 — State Estimation · v0.1 · 2026-10-26

■ 방법

  • 탭 4개: Noise & Averaging / Kalman Filter / Sensor Fusion / Tracking in 2D. 탭마다 개요·체험 2개·요약·참고문헌
  • 평균: 참값 20, σ 0.2–5, n 5–500. 같은 실험 300번으로 평균의 표준편차를 실제로 잼. 두 센서: 무게 w에 따른 표준편차 √(w²σ₁² + (1−w)²σ₂²), 역분산 가중 답 표시
  • 칼만 필터: 등속 모형(연속 백색 잡음 가속도, Q = q[dt³/3, dt²/2; dt²/2, dt]), 위치 측정. 실제 q·σ와 필터가 믿는 Q·R 배수(10^±3)를 따로 둠. 측정 끊김 60–85. 직접 움직이기: 초당 20번 측정, 누르는 동안 갱신 없이 예측만
  • 센서 융합: 참 각도는 끌어 정한 목표를 2차 계(ω² = 40, 감쇠 9)로 따라감. 자이로 = 각속도 + 편향 + 잡음 0.01, 가속도계 각도 = 각도 + 잡음 + 0.02·각가속도(흔들림). 상보 필터 θ = α(θ + ωΔt) + (1−α)θ_acc, 50 Hz. α 찾기: 정해진 30초 움직임(100 Hz)에서 α = 1 − 10^(−3…−0.2)
  • 2차원 추적: 끌어 그린 길을 0.006 간격으로 다시 나눔, 4상태 등속 칼만 필터, 측정 잡음 σ, 엉뚱한 측정(±0.25 균등)의 비율, 게이트 d² > 13.8(χ² 2자유도 99.9%)이면 갱신 안 함, 끊김 45–60% 구간, RTS 평활, 2σ 타원은 위치 공분산의 고유값
  • 직접 쓴 JavaScript(se-core.js, se.js), 외부 라이브러리 없음 · LLM 없음

■ 데이터

  • 모든 센서 값은 브라우저에서 시드 고정 난수로 시뮬레이션. 외부 자료 없음

■ 검증

  • tests/state-estimation/core-test.mjs 12항목 통과
  • q = 0 칼만 = 누적 평균(차이 1.5e-6, 사전 분산 1e12 때문) · q = 0 등속 칼만 = 최소제곱 직선(위치·속도)
  • 정상 상태 사후 공분산 = scipy 1.18.1 solve_discrete_are(q 0.5, r 4)로 구한 값(차이 4.5e-9)
  • 잘 맞춘 필터의 NIS(정규화 혁신 제곱) 평균 1.001(이론 1)
  • 오차 RMS: 측정 2.68 → 맞춘 필터 1.61, Q×1,000 2.42, Q×0.01·R×100 19.54 · RTS 평활 0.875 < 필터 1.459
  • 상보 필터: α = 1은 자이로 적분, α = 0은 가속도계와 같음. α 0.98 오차 0.041 rad < 자이로 0.369 · 가속도계 0.276
  • 역분산 가중 w 0.8, 표준편차 √0.8

■ 범위

  • 선형 모형과 가우스 잡음만(EKF·UKF·입자 필터는 다루지 않음). 각도는 한 축, 실제 IMU의 축 정렬·자력계 없음

■ 출처

  • Gauss (1823), Kalman (1960), Rauch·Tung·Striebel (1965), Higgins (1975), Welch & Bishop (2006), Mahony et al. (2008), Madgwick et al. (2011), Bar-Shalom et al. (2001), Särkkä (2013), Taylor (1997)

■ 이력

  • 2026-10-26 · v0.1 · 처음 만듦 · 공개 준비 중

How it's built — State Estimation · v0.1 · 2026-10-26

■ Method

  • Four tabs: Noise & Averaging / Kalman Filter / Sensor Fusion / Tracking in 2D. Each tab has an overview, two hands-on parts, a summary and references
  • Averaging: true value 20, σ 0.2–5, n 5–500. The standard deviation of the mean is measured from 300 repeats. Two sensors: standard deviation √(w²σ₁² + (1−w)²σ₂²) against the weight w, with the inverse-variance answer marked
  • Kalman filter: constant-velocity model (continuous white-noise acceleration, Q = q[dt³/3, dt²/2; dt²/2, dt]), position measurements. The real q and σ are set separately from the Q and R multipliers the filter believes (10^±3). Dropout at steps 60–85. Live: 20 measurements per second; while held, prediction only
  • Sensor fusion: the true angle follows the dragged target as a second-order system (ω² = 40, damping 9). Gyro = rate + bias + noise 0.01; accelerometer angle = angle + noise + 0.02·angular acceleration (shake). Complementary filter θ = α(θ + ωΔt) + (1−α)θ_acc at 50 Hz. Finding α: a fixed 30 s motion (100 Hz) with α = 1 − 10^(−3…−0.2)
  • Tracking in 2D: the drawn path is resampled at 0.006 spacing; 4-state constant-velocity Kalman filter; measurement noise σ; rate of wild measurements (uniform ±0.25); gate skips the update when d² > 13.8 (χ², 2 dof, 99.9%); dropout over 45–60% of the path; RTS smoothing; 2σ ellipses from the eigenvalues of the position covariance
  • Hand-written JavaScript (se-core.js, se.js), no external libraries · no LLM

■ Data

  • All sensor values are simulated in the browser with seeded random numbers. No external data

■ Validation

  • tests/state-estimation/core-test.mjs, 12 checks pass
  • Kalman with q = 0 = running mean (difference 1.5e-6, from the 1e12 prior) · constant-velocity Kalman with q = 0 = least-squares line (position and velocity)
  • Steady-state posterior covariance = scipy 1.18.1 solve_discrete_are (q 0.5, r 4), difference 4.5e-9
  • Mean NIS (normalized innovation squared) of a well-tuned filter 1.001 (theory 1)
  • Error RMS: measurements 2.68 → tuned filter 1.61, Q×1,000 2.42, Q×0.01·R×100 19.54 · RTS smoothing 0.875 < filter 1.459
  • Complementary filter: α = 1 equals gyro integration, α = 0 equals the accelerometer. α 0.98 error 0.041 rad < gyro 0.369 · accelerometer 0.276
  • Inverse-variance weight 0.8, standard deviation √0.8

■ Scope

  • Linear models and Gaussian noise only (no EKF, UKF or particle filters). Tilt on one axis; no axis alignment or magnetometer of a real IMU

■ Sources

  • Gauss (1823), Kalman (1960), Rauch, Tung & Striebel (1965), Higgins (1975), Welch & Bishop (2006), Mahony et al. (2008), Madgwick et al. (2011), Bar-Shalom et al. (2001), Särkkä (2013), Taylor (1997)

■ History

  • 2026-10-26 · v0.1 · first version · not yet public