| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Symbolic Math Toolbox |
| Contents | Index |
| Learn more about Symbolic Math Toolbox |
| On this page… |
|---|
Version 5 of Symbolic Math Toolbox is powered by the MuPAD symbolic engine.
Nearly all Symbolic Math Toolbox functions work the same way as in previous versions. To read about the differences with the new engine, see the transition Release Notes.
MuPAD notebooks provide a new interface for performing symbolic calculations, variable-precision calculations, plotting, and animations. Introductory Example Using a MuPAD Notebook from MATLAB contains an introductory example of how to use this interface.
Symbolic Math Toolbox functions allow you to copy variables and expressions between the MATLAB workspace and MuPAD notebooks. For more information, see Copying Variables and Expressions Between the MATLAB Workspace and MuPAD Notebooks.
You can call MuPAD functions and procedures from the MATLAB environment. For more information, see Calling MuPAD Functions at the MATLAB Command Line.
A MuPAD engine is a separate process that runs on your computer in addition to a MATLAB process. A MuPAD engine starts when you first call a function that needs a symbolic engine, such as syms. Symbolic Math Toolbox functions that use the symbolic engine use standard MATLAB syntax, such as y = int(x^2).
Conceptually, each MuPAD notebook has its own symbolic engine, with associated workspace. You can have any number of MuPAD notebooks open simultaneously.

The engine workspace associated with the MATLAB workspace is generally empty, except for assumptions you make about variables. For more information, see Clearing Assumptions and Resetting the Symbolic Engine.
This example shows how to use a MuPAD notebook to calculate symbolically the mean and variance of a normal random variable that is restricted to be positive. For more information on using a MuPAD notebook, see Calculating in a MuPAD Notebook.
The density function of the normal and positive random variable is
![]()
At the MATLAB command line, enter the command
mupad
A blank MuPAD notebook opens. You perform calculations by typing in the input area, demarcated by a left bracket.

In the input area, type
f := exp(-x^2/2)*sqrt(2/PI)
and press Enter.
Note Assignment in a MuPAD notebook uses :=, not the MATLAB syntax =. Also, the MuPAD syntax for the mathematical constant π is PI, not the MATLAB syntax pi. For more information on common syntax differences, see Differences Between MATLAB and MuPAD Syntax. |
The MuPAD notebook displays results in real math notation.
Your notebook appears as follows.

The mean of the random variable is
![]()
To calculate the mean of the random variable, type
mean :=
To place an integral in the correct syntax, click the integral button in the right-hand command bar, and select definite limits as shown.

The correct syntax for integration appears in the input area.
![]()
Replace #f with x*f, #x with x, #a with 0, and #b with infinity.
Use the Tab key to select the replaceable fields #f, #x, etc.
Use Ctrl+space to autocomplete inputs; e.g., enter infi followed by Ctrl+space to enter infinity.
Once your input area reads
mean := int(x*f, x=0..infinity)
press Enter.

The variance of the random variable is
![]()
To calculate the variance of the random variable, type
variance := int((x-mean)^2*f, x=0..infinity)
and press Enter.

The result of evaluating variance is a complicated expression. Try to simplify it with the simplify command. Type
simplify(variance)
and press Enter. The result is indeed simpler.

Another expression for the variance of the random variable is
![]()
To calculate the variance of the random variable using this definition, type
variance2 := int(x^2*f, x=0..infinity) - mean^2
and press Enter.

The two expressions for variance, variance and variance2, are obviously equivalent.
For more information on working in MuPAD notebooks, select Help > Open Help, or press F1 to launch the MuPAD Help viewer.

Within the MuPAD Help viewer, both the "Getting Started" and "The MuPAD Notebook Interface" sections can help you understand and use MuPAD notebooks.
![]() | MuPAD in Symbolic Math Toolbox | MuPAD for MATLAB Users | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |