Theory and Hands-On Practical with IFDIFF
Thursday, July 09, 2026 • 9:00–16:00
Mathematikon • CIP Pools 3rd Floor • and Online
Im Neuenheimer Feld 205 • 69120 Heidelberg
Participation is free. Register here!
The software package IFDIFF comprises:
- Automatic detection and processing of state-dependent switching events in ODE IVPs
- Automatic generation of only the necessary switching functions (exported as MATLAB code)
- Accurate switching point detection up to machine precision
- Detection and handling of Filippov sliding mode
- ODEs with state-jumps and model switches
- Sensitivity generation for switched ODEs, ODEs with state-jumps and Filippov ODEs
Sensitivities can be generated w.r.t. the initial values and w.r.t. a given parameter set.
For a mathematical introduction and illustrative examples, see the
IFDIFF project page.
A compact, self-explanatory MATLAB example is provided in this file. (Readme_Example.m)
There are two ways to install IFDIFF locally. Alternatively, you may use IFDIFF without any local installation in the cloud-based "MATLAB Online" environment. In that case, press the "Open in MATLAB Online" button below to import the IFDIFF repository in MATLAB Online.
-
Download the IFDIFF toolbox file (
IFDIFF_Toolbox_vXXX.mltbx) from the releases page. -
Open MATLAB and navigate to the directory containing the toolbox file.
-
Install the toolbox file:
-
From the GUI (recommended):
- MATLAB R2025a or newer: Double click the toolbox file in the MATLAB Files panel.
- MATLAB R2024b or older: Right-click the toolbox file in the MATLAB Current Folder browser and select Install.
-
From the command window (alternative):
- MATLAB R2016a or newer: Run the following command in the MATLAB Command Window (after replacing the placeholder text
'IFDIFF_Toolbox_vXXX.mltbx'with the actual name of your toolbox file):
matlab.addons.toolbox.installToolbox('IFDIFF_Toolbox_vXXX.mltbx');
- MATLAB R2016a or newer: Run the following command in the MATLAB Command Window (after replacing the placeholder text
-
-
For a practical introduction to IFDIFF, view the Getting Started Guide (
GettingStarted.mlx). The guide should open automatically after installing the toolbox file from the GUI.
You can also open the guide manually:- From the MATLAB Add-On Manager (recommended):
- Open the MATLAB Add-On Manager (Home tab > Environment section > Add-Ons > Manage Add-Ons).
- Find the "IFDIFF Toolbox" Add-On in the list of installed Add-Ons.
- Open the context menu by right-clicking the "IFDIFF Toolbox" Add-On or clicking on the three dots that appear on the right when hovering over the "IFDIFF Toolbox" Add-On.
- Click on the "View Getting Started Guide" button in the context menu.
- From the file browser (alternative):
- Open the toolbox installation folder. See the MATLAB Documentation on the Default Add-On Installation Folder for detailed instructions on how to find the installation folder.
- In the toolbox folder, navigate to the subfolder
docand open the fileGettingStarted.mlxin MATLAB.
- From the MATLAB Add-On Manager (recommended):
- Navigate to a location of your choice on your PC (e.g. Desktop).
- Clone the repository
git clone https://github.com/andreassommer/ifdiff.git. - Open MATLAB and navigate to the cloned
ifdiffdirectory. - For a practical introduction to IFDIFF, open the Getting Started Guide (
GettingStarted.mlx) in MATLAB. You can find the guide in the subfoldertoolbox/doccontained in the clonedifdiffdirectory.
For a step-by-step usage example and background explanation, see the IFDIFF project page.
Afterwards, you can check out the Getting Started Guide in MATLAB for a hands-on walkthrough on how to use IFDIFF. If you have trouble finding the Getting Started Guide, please refer to the last step of the installation section for toolbox installations or full repository installations (whichever applies in your case).
After installing IFDIFF for the first time, you must run the following command in the MATLAB Command Window before you can start using IFDIFF:
initIFDIFFAfter running the command, you will receive a prompt in the Command Window asking you to let IFDIFF generate the mtreeplus class, which is a copy of MATLAB's internal parser class mtree on which IFDIFF heavily relies. Enter y in the Command Window to proceed and wait for the script to finish running. At the end you should see a message confirming that the mtreeplus class was generated successfully.
If you have not installed IFDIFF as a toolbox, then you must manually setup the MATLAB path to access IFDIFF functions on each MATLAB session before you can use IFDIFF. To do this, run the following command in the MATLAB Command Window:
initIFDIFF