:orphan:

Matlab Examples
===============

These examples are written for use with the "experimental" version of the Cantera Matlab
toolbox that was introduced with Cantera 3.0.

.. caution::
    The MATLAB toolbox is an experimental part of the Cantera API and may be changed
    without notice.



.. raw:: html

    <div class="sphx-glr-thumbnails">

.. thumbnail-parent-div-open

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip=" In this example, the area ratio vs. Mach number curve is computed for a hydrogen/nitrogen gas mixture.">

.. only:: html

  .. image:: /examples/matlab/images/thumb/sphx_glr_isentropic_thumb.png
    :alt:

  :ref:`sphx_glr_examples_matlab_isentropic.m`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Isentropic nozzle flow</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip=" This example computes the adiabatic flame temperature and equilibrium composition for a methane/air mixture as a function of equivalence ratio.">

.. only:: html

  .. image:: /examples/matlab/images/thumb/sphx_glr_equil_thumb.png
    :alt:

  :ref:`sphx_glr_examples_matlab_equil.m`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Methane/air chemical equilibrium</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip=" This example illustrates how to use class Reactor for zero-dimensional kinetics simulations. Here the parameters are set so that the reactor is adiabatic and constant volume.">

.. only:: html

  .. image:: /examples/matlab/images/thumb/sphx_glr_reactor2_thumb.png
    :alt:

  :ref:`sphx_glr_examples_matlab_reactor2.m`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Adiabatic, constant volume reactor</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip=" Calculate the efficiency of a Rankine vapor power cycle using a pure fluid model for water.">

.. only:: html

  .. image:: /examples/matlab/images/thumb/sphx_glr_rankine_thumb.png
    :alt:

  :ref:`sphx_glr_examples_matlab_rankine.m`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Rankine cycle</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip=" This example does the same thing as prandtl1, but using the multicomponent expression for the thermal conductivity.">

.. only:: html

  .. image:: /examples/matlab/images/thumb/sphx_glr_prandtl2_thumb.png
    :alt:

  :ref:`sphx_glr_examples_matlab_prandtl2.m`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Prandtl number for an equilibrium H/O gas mixture</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip=" This example computes and plots the Prandtl number for a hydrogen / oxygen mixture in chemical equilibrium for P = 1 atm and a range of temperatures and elemental O/(O+H) ratios.">

.. only:: html

  .. image:: /examples/matlab/images/thumb/sphx_glr_prandtl1_thumb.png
    :alt:

  :ref:`sphx_glr_examples_matlab_prandtl1.m`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Prandtl number for an equilibrium H/O gas mixture</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip=" Solves the same ignition problem as reactor2, except using the local function REACTOR_ODE to implement the governing equations for an adiabatic, constant-volume, zero-dimensional reactor.">

.. only:: html

  .. image:: /examples/matlab/images/thumb/sphx_glr_ignite_uv_thumb.png
    :alt:

  :ref:`sphx_glr_examples_matlab_ignite_uv.m`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Constant volume ignition with user-specified equations</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip=" Solves the same ignition problem as reactor1, but uses the local function REACTOR_ODE to implement the governing equations for an adiabatic, constant-pressure, zero-dimensional reactor.">

.. only:: html

  .. image:: /examples/matlab/images/thumb/sphx_glr_ignite_hp_thumb.png
    :alt:

  :ref:`sphx_glr_examples_matlab_ignite_hp.m`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Constant pressure ignition with user-specified equations</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip=" This example illustrates how to use class Reactor for zero-dimensional kinetics simulations. Here the parameters are set so that the reactor is adiabatic and very close to constant pressure.">

.. only:: html

  .. image:: /examples/matlab/images/thumb/sphx_glr_reactor1_thumb.png
    :alt:

  :ref:`sphx_glr_examples_matlab_reactor1.m`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Adiabatic, constant pressure reactor</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip=" This example computes the growth rate of a diamond film according to a simplified version of a particular published growth mechanism (see file diamond.yaml for details). Only the surface coverage equations are solved here; the gas composition is fixed. (For an example of coupled gas-phase and surface, see catalytic_combustion).">

.. only:: html

  .. image:: /examples/matlab/images/thumb/sphx_glr_diamond_cvd_thumb.png
    :alt:

  :ref:`sphx_glr_examples_matlab_diamond_cvd.m`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Simulating growth of a diamond film by CVD</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip=" This example illustrates how to use class Reactor for zero-dimensional simulations including both homogeneous and heterogeneous chemistry.">

.. only:: html

  .. image:: /examples/matlab/images/thumb/sphx_glr_surf_reactor_thumb.png
    :alt:

  :ref:`sphx_glr_examples_matlab_surf_reactor.m`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Zero-dimensional reactor with surface chemistry</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip=" This script simulates a burner-stabilized lean hydrogen-oxygen flame at low pressure. This example is equivalent to the Python ../python/onedim/burner_flame example.">

.. only:: html

  .. image:: /examples/matlab/images/thumb/sphx_glr_burner_flame_thumb.png
    :alt:

  :ref:`sphx_glr_examples_matlab_burner_flame.m`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Burner-stabilized flat flame</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip=" MATLAB demo program to compute flame speeds using GRI-Mech. This example is equivalent to the C++ ../cxx/flamespeed example.">

.. only:: html

  .. image:: /examples/matlab/images/thumb/sphx_glr_flamespeed_thumb.png
    :alt:

  :ref:`sphx_glr_examples_matlab_flamespeed.m`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Freely-propagating flame</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip=" This example illustrates a continuously stirred tank reactor (CSTR) with steady inputs but periodic interior state.">

.. only:: html

  .. image:: /examples/matlab/images/thumb/sphx_glr_periodic_cstr_thumb.png
    :alt:

  :ref:`sphx_glr_examples_matlab_periodic_cstr.m`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Continuously stirred tank reactor with periodic behavior</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip=" This example uses the CounterFlowDiffusionFlame object to solve an opposed-flow diffusion flame for Ethane in Air. This example is the same as the ../python/onedim/diffusion_flame example without radiation.">

.. only:: html

  .. image:: /examples/matlab/images/thumb/sphx_glr_diffusion_flame_thumb.png
    :alt:

  :ref:`sphx_glr_examples_matlab_diffusion_flame.m`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Opposed-flow diffusion flame</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip=" This example file calculates the cell voltage of a lithium-ion battery at given temperature, pressure, current, and range of state of charge (SOC).">

.. only:: html

  .. image:: /examples/matlab/images/thumb/sphx_glr_lithium_ion_battery_thumb.png
    :alt:

  :ref:`sphx_glr_examples_matlab_lithium_ion_battery.m`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Lithium-ion battery</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip=" This script solves a catalytic combustion problem. This example is equivalent to the Python ../python/onedim/catalytic_combustion example.">

.. only:: html

  .. image:: /examples/matlab/images/thumb/sphx_glr_catalytic_combustion_thumb.png
    :alt:

  :ref:`sphx_glr_examples_matlab_catalytic_combustion.m`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Catalytic combustion of a stagnation flow on a platinum surface</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip=" This code snippet is to model a constant area and varying area (converging and diverging) nozzle as Plug Flow Reactor with given dimensions and an incoming gas. The pressure is not assumed to be constant here, as opposed to the Python Version of the Plug Flow Reactor model.">

.. only:: html

  .. image:: /examples/matlab/images/thumb/sphx_glr_plug_flow_reactor_thumb.png
    :alt:

  :ref:`sphx_glr_examples_matlab_plug_flow_reactor.m`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Nozzle with compressible flow</div>
    </div>


.. thumbnail-parent-div-close

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /examples/matlab/isentropic
   /examples/matlab/equil
   /examples/matlab/reactor2
   /examples/matlab/rankine
   /examples/matlab/prandtl2
   /examples/matlab/prandtl1
   /examples/matlab/ignite_uv
   /examples/matlab/ignite_hp
   /examples/matlab/reactor1
   /examples/matlab/diamond_cvd
   /examples/matlab/surf_reactor
   /examples/matlab/burner_flame
   /examples/matlab/flamespeed
   /examples/matlab/periodic_cstr
   /examples/matlab/diffusion_flame
   /examples/matlab/lithium_ion_battery
   /examples/matlab/catalytic_combustion
   /examples/matlab/plug_flow_reactor


.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-gallery

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download all examples as source code: matlab.zip </examples/matlab/matlab.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
