Skip to content

save2matlab

Cristel Chandre edited this page Jun 24, 2025 · 5 revisions

save2matlab (function)

Purpose

Saves the results of a simulation to a .mat file compatible with MATLAB.

Parameters

  • sol: Solution object returned by an ODE solver (e.g., solve_ivp), containing time and state arrays.
  • filename: Name of the output file (default: 'data'). The function saves to filename.mat.

Saved Data

The following variables are saved in the .mat file:

  • t: Time array (sol.t).
  • X: State variables (first N rows of sol.y, transposed).
  • Xs: Desymmetrized state variables, transposed.
  • Y: State variables $Y=\phi(X)$.
  • Ys: Desymmetrized Y.
  • Casimirs: Casimir invariants (self.casimir_coeffs).
  • phi: (str) Matlab function corresponding to the function $\phi(x)$ used in the computations.
  • date: Current date.
  • author: Hardcoded as 'cristel.chandre@cnrs.fr'.

Features

  • Uses scipy.io.savemat to write the data.
  • Prints a confirmation message with the file name.

Notes

Clone this wiki locally