Loading repository data…
Loading repository data…
matlab-deep-learning / repository
This repository collates a number of MATLAB examples demonstrating Scientific Machine Learning (SciML) and Physics Informed Machine Learning.
This repository collates a number of examples demonstrating Scientific Machine Learning (SciML) and Physics-Informed Machine Learning.
Scientific Machine Learning is the application of Artificial Intelligence (AI) methods to accelerate scientific and engineering discoveries. SciML methods can incorporate domain specific knowledge, such as mathematical models of a physical system, with data-driven methods, such as training neural networks. Some characteristic SciML methods include:
Download or clone this repository and explore the examples in each sub-directory using MATLAB®.
Requires MATLAB®.
Physics-Informed Neural Networks are neural networks that incorporate a differential equation in the loss function to encourage the neural network to approximate the solution of a PDE, or to solve an inverse problem such as identifying terms of the governing PDE given data samples of the solution. Automatic differentiation via dlarray makes it easy to compute the derivatives terms in the PDE via dlgradient for derivatives of scalar quantities, dljacobian for computing Jacobians, and dllaplacian, dldivergence for computing Laplacians and divergences respectively.
Explore the following examples on PINNs.
The following video content for PINNs is also available:
Neural ordinary differential equations incorporate solving an ODE as a fundamental operation in a model, for example as a layer in a neural network such as neuralODELayer, or an ODE solver like dlode45 that integrates with the automatic differentiation framework such as the dlarray data type. Neural ODE solvers can be used in methods relevant to engineering such as neural state space models that can be trained with idNeuralStateSpace and nlssest from System Identification Toolbox™.
Explore the following examples on neural ODEs.
Neural operators are typically used to learn mappings between infinite dimensional function spaces. Many PDE problems can be phrased in terms of operators. For example the parameterised differential operator $L_a$ defined by $L_a u := \nabla \cdot \left(a \nabla u\right)$ can be used to specify a Poisson problem $L_a u = \nabla \cdot \left(a \nabla u \right) = f$ on a domain $\Omega$ as an operator problem. Given appropriate sets of functions $f \in \mathcal{V}$ and $a \in \mathcal{W}$, let $\mathcal{U}$ denote the set of solutions $u$ satisfying Dirichlet boundary condition $u = 0$ on $\partial \Omega$, and $L_a u = f$ on $\Omega$ for some $f \in \mathcal{V}$ , $a \in\mathcal{W}$. The solution operator $G:\mathcal{V} \times \mathcal{W} \rightarrow \mathcal{U}$ is defined as $G(f,a)= u$ such that $L_a u = f$. Neural operator methods train neural networks $G_\theta$ to approximate the operator $G$. A trained neural operator $G_\theta$ can be used to approximate the solution $u$ to $L_a u = f$ by evaluating $G_\theta (f,a)$ for any $f \in \mathcal{V}, a \in \mathcal{W}$
Graph neural networks are neural network architectures designed to operate naturally on graph data $G = (E,V)$, where $V = {v_1, \ldots, v_n}$ is a set of $n$ vertices, and $E$ is a set of edges $e = (v_i,v_j)$ specifying that vertices $v_i$ and $v_j$ are connected. Both the vertices and edges may have associated features. Graph neural networks use natural operations for graph data such as graph convolutions which generalise a standard 2d discrete convolution.
Explore the following examples on GNNs.
The Hamiltonian neural network method trains a neural network to approximate the Hamiltonian of a mechanical system, as specified in Hamiltonian formulation of mechanics. The Hamiltonian formulation of mechanics specifies a mechanical system in terms of generalized coordinates $(q,p)$ where $q$ is a vector representation of the position of a point mass, and $q$ is a vector representation of the momentum. Hamiltonian mechanics specifies that the evolution of $p(t)$ and $q(t)$ in time can be specified by the ODE system $\frac{\mathrm{d}q}{\mathrm{d}t} = \frac{\partial H}{\partial p}$, $\frac{\mathrm{d}p}{\mathrm{d}t} = - \frac{\partial H}{\partial q}$ where $H(p,q,t)$ is called the Hamiltonian. By approximating $H$ by a neural network $H_\theta$ it is possible to compute $\frac{\partial H_\theta}{\partial p}, \frac{\partial H_\theta}{\partial q}$ and impose a loss based on the ODE system above, similar to the method of PINNs.
The license is available in the license.txt file in this GitHub repository.
Copyright 2024-2026 The MathWorks, Inc.