symFunType
Determine functional type of symbolic object
Syntax
Description
returns the functional type of a symbolic object.s
= symFunType(symObj
)
If
symObj
is a symbolic function or a symbolic expression, thensymFunType
returns the topmost function name or operator ofsymObj
. For example,syms x; symFunType(2*sin(x))
returns"times"
.If
symObj
is not a symbolic function or a symbolic expression, thensymFunType
returns the same output assymType
. For example,symFunType(sym('2'))
returns"integer"
.
Examples
Symbolic Function or Expression
Create an array of symbolic functions and expressions.
syms f(x)
expr = [f(x) sin(x) exp(x) int(f(x)) diff(f(x))]
expr =
Determine the functional type of each array element.
s = symFunType(expr)
s = 1x5 string
"f" "sin" "exp" "int" "diff"
Topmost Arithmetic Operators of Symbolic Expressions
Create two symbolic expressions. Determine the topmost arithmetic operators of the expressions.
syms x
expr1 = x/(x^2+x+2);
expr2 = x + 1/(x^2+x+2);
s1 = symFunType(expr1)
s1 = "times"
s2 = symFunType(expr2)
s2 = "plus"
To return the terms separated by the operators, use children
.
terms1 = children(expr1)
terms1=1×2 cell array
{[x]} {[1/(x^2 + x + 2)]}
terms2 = children(expr2)
terms2=1×2 cell array
{[x]} {[1/(x^2 + x + 2)]}
Comparison Operators in Equations and Inequalities
Create an array of symbolic equations and inequalities.
syms x y eqns = [x+y==2, x<=5, y>3]
eqns =
Determine the topmost comparison operator in each array element.
s = symFunType(eqns)
s = 1x3 string
"eq" "le" "lt"
Input Arguments
symObj
— Symbolic objects
symbolic expressions | symbolic functions | symbolic variables | symbolic numbers | symbolic units
Symbolic objects, specified as symbolic expressions, symbolic functions, symbolic variables, symbolic numbers, or symbolic units.
Output Arguments
s
— Symbolic functional types
string array
Symbolic functional types, returned as a string array. If symObj
is a symbolic function or a symbolic expression, then symFunType
returns the topmost function name or operator of symObj
. This table
shows output values for various symbolic objects.
Symbolic Functional Types | Returned Output | Input Example |
---|---|---|
symbolic math functions | "sin" , "exp" ,
"fourier" , and so on — name of the topmost symbolic math
function in a symbolic expression | syms f(x); symFunType([sin(x), exp(x),
fourier(f(x))]) |
unassigned symbolic functions |
| syms f(x) g(x); symFunType([f, g(x+2)]) |
arithmetic operators |
|
|
equations and inequalities |
|
|
logical operators and constants |
|
|
numbers |
|
|
constants |
| symFunType(sym([pi catalan])) |
variables |
| symFunType(sym(x)) |
units |
| symFunType(symunit('m')) |
unsupported symbolic types | "unsupported" |
Version History
Introduced in R2019a
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)