Fast Temperature Simulator, C-code Interface for MATLAB

Scripts for temperature simulations.

We are sharing software for temperature simulations.

Get the Code

The software available on this page is provided free of charge and comes without any warranty. CAI²R and NYU Grossman School of Medicine do not take any liability for problems or damage of any kind resulting from the use of the files provided. Operation of the software is solely at the user’s own risk. The software developments provided are not medical products and must not be used for making diagnostic decisions.

The software is provided for non-commercial, academic use only. Usage or distribution of the software for commercial purpose is prohibited. All rights belong to the author (Leeor Alon) and NYU Grossman School of Medicine. If you use the software for academic work, please give credit to the author in publications and cite the related publications.

Please spell out your affiliation (e.g. "New York University" rather than "NYU").

How to Use

To compile the program, go to the directory where the TempSim.cpp file is located.

To launch the temperature simulator:

  1. In MATLAB’s command window, run
    mex TempSim.cpp
    The expected output is
    MEX completed successfully
  2. The calculator can now be run with following command line:
    [T]=TempSim(C,K,R,Q,W,SAR,Tinitial,[dx, dy, dz],steps,dt,airtemp);
    • C is the 3d distribution of the heat capacity in units of J/kg/°C
    • K is the 3d distribution of the thermal conductivity in units of W/m/°C
    • R is the 3d distribution of the tissue density in units of kg/m3
    • Q is the 3d distribution of the metabolic energy generation term in units of W/m3
    • W is the 3d distribution of the thermal perfusion coefficient in units of mL/100g/min
    • SAR is the 3d distribution of the specific absorption rate in units of /kg
    • Tinitial is the 3d distribution of the initial temperature in units of kelvin
    • dx, dy, dz are the voxel sizes in the x, y and z directions, respectively, in units of meter
    • steps is the number of steps in which the temperature simulation would run
    • dt is the time step of each step
    • airtemp is the temperature of air in units of kelvin


Collins CM, Liu W, Wang J, Gruetter R, Vaughan JT, Ugurbil K, Smith MB.
Temperature and SAR calculations for a human head within volume and surface coils at 64 and 300 MHz.
J Magn Reson Imaging. 2004 May;19(5):650-6. doi: 10.1002/jmri.20041

The fast simulation technique is based on the above reference.


Questions about this resource may be directed to Leeor Alon, PhD.