Data
Smoother
Smoothed signal
First derivative (curvature)
Second derivative
GCV / AIC scan
Bend table
Method
The fit is a penalized B-spline (Eilers and Marx, 1996). Given noisy observations yi at locations xi, we represent the unknown function as a linear combination of M = K + p evenly-spaced B-splines of degree p: f(x) = Σ αj Bj(x). The coefficients α are found by minimizing
||y - Bα||² + λ · ||D α||²
where D is the d-th order finite-difference operator and λ ≥ 0 controls the trade-off between fidelity and smoothness. The solution is α = (BTB + λ DTD)-1 BTy and the smoothed values are ŷ = Bα.
Derivatives of the fit are obtained analytically using the B-spline derivative recursion dBi,p/dx = (p/h)(Bi,p-1 - Bi+1,p-1), which is much more reliable than finite-differencing the noisy data. The first derivative is the local curvature for an IMU pitch / yaw signal along a pipeline.
Optimal λ is chosen by Generalized Cross-Validation: GCV(λ) = (n · RSS) / (n - tr(H))², with H = B (BTB + λ DTD)-1 BT the hat matrix. AIC = n · log(RSS/n) + 2·tr(H) is shown alongside for reference.
Bend detection: peak finding on the absolute first derivative with a height threshold equal to a multiple of the residual standard deviation propagated through the derivative basis.
Related publications
- Talebi-Kalaleh, M.; Tan, L.; Shirzad, N.; Adeeb, S.; Mei, Q. (2026). Penalized B-Spline Curvature Estimation for Automated Pipeline Bend Detection from Inertial Measurement Unit Data. ASME IPC 2026, Paper IPC2026-186408.
- Eilers, P.H.C.; Marx, B.D. (1996). Flexible Smoothing with B-splines and Penalties. Statistical Science, 11(2), 89-121.
- de Boor, C. (2001). A Practical Guide to Splines, revised ed., Springer.