sympref
Gets or sets preferences of the Symbolic Math Toolbox.
Category: Symbolic Computations in MATLAB > Symbolic Variables, Expressions, Functions, and Preferences
Syntax
sympref(name, value)
Sets the preference name to value.
old = sympref(name, value)
Sets the preference and returns its previous value.
sympref('default')
Restores every preference to its default.
prefs = sympref
Returns a structure with the current preferences.
Description
Preferences affect how results are displayed and how a few special values are defined. 'HeavisideAtOrigin' sets the value of heaviside(0), 'FourierParameters' sets the convention of fourier, and 'FloatingPointOutput' shows results as floating-point numbers instead of exact values.
Preferences last for the session. Call sympref('default') to reset them, which is good practice at the start and end of a script that changes them.
Input arguments
name- Preference name:
'FloatingPointOutput','PolynomialDisplayStyle','HeavisideAtOrigin','AbbreviateOutput','MatrixWithSquareBrackets','FourierParameters','TypesetOutput'. value- New value for the preference.
Output arguments
old- Previous value of the preference, or a struct of all preferences.
Example
Changing and restoring a preference
sympref('HeavisideAtOrigin', 1);
heaviside(sym(0))
sympref('default');
heaviside(sym(0))
ans = 1
ans = 1/2
Notes
MatLivre stores every preference, but of them only 'HeavisideAtOrigin', 'FourierParameters' and 'FloatingPointOutput' change results. The display preferences 'PolynomialDisplayStyle' and 'MatrixWithSquareBrackets' are accepted and have no effect on the output.