arXiv:2611.05031eess.SYNov 2026

Manuscript Offprint

arXiv:2611.05031

Comparing model representations and fitting methods for port-Hamiltonian system identification

Sølve Eidnes, Håkon Noren Myhr

Sølvø Eidnes * Håkon Noren Myhr **

** Department of Mathematical Sciences, Norwegian University of Science and Technology, Trondheim, Norway.

Abstract: Port-Hamiltonian models describe physical systems by separating stored energy, dissipation and external inputs. Learning such models from data requires a choice of representation and fitting method. We compare using neural networks, analytic expressions and combinations of the two for representing the different components of the port-Hamiltonian system, and compare fitting the models with gradient-based optimisation or sparse regression. Testing on simulations of mechanical and electrical systems, with and without added noise, we present prediction accuracy and computational cost of the different approaches.

Keywords: System identification; port-Hamiltonian systems; neural networks; sparse regression; nonlinear systems; data-driven modelling.

1. INTRODUCTION

Port-Hamiltonian models describe dynamics using separate functions for stored energy, dissipation and coupling to the surroundings through external inputs (van der Schaft and Jeltsema, 2014). To identify systems of this form from data one must choose how to represent the unknown functions and how to fit them to observations. Preserving the port-Hamiltonian structure allows the learned energy, dissipation and input map to be interpreted separately and provides a basis for control.

The unknown functions can be represented by analytic expressions obtained by fitting combinations of prescribed candidate functions (Lee et al., 2022; Holmsen et al., 2024; Myhr et al., 2026). Neural-network representations have been considered for the same purpose (Desai et al., 2021; Eidnes et al., 2023), building on Hamiltonian neural networks (Greydanus et al., 2019). Hybrid representations combine analytic expressions for some functions with neural networks for others (Holmsen et al., 2024; Cherifi et al., 2026; Khosrovan et al., 2024).

Sparse regression is used to select a small set of terms in a differential equation from a candidate library (Brunton et al., 2016) and has been adapted to jointly identify the energy and dissipation of port-Hamiltonian systems (Myhr et al., 2026). Gradient-based optimisation is widely used to fit neural networks but has also been used to fit the coefficients of analytic port-Hamiltonian models (Lee et al., 2022; Holmsen et al., 2024). We compare two variants of each of these approaches, giving four different fitting methods. Our gradient-based optimisation minimises

either integration-scheme residuals or errors in simulated trajectories. Our sparse-regression fits alternate ridge-regularised linear least-squares solves with term removal, using estimated derivatives or a midpoint discretisation.

In this paper, we compare the three types of representation and the two families of fitting methods, summarised in Figure 1, to examine how the choices affect prediction accuracy and computational cost when applied to data from simulated mechanical and electrical systems. We briefly consider how well the different models have learned the input gain, but a broader assessment of the identified functions is outside the scope of this study. This can, however, be explored using our public code on https://github.com/SINTEF/PHSI.