piecewise
Conditionally defined expression or function
Syntax
Description
Examples
Input Arguments
Output Arguments
Tips
piecewisedoes not check for overlapping or conflicting conditions. A piecewise expression returns the value of the first true condition and disregards any following overlapping true expressions. Thus,piecewisefollows the behavior of an if-else statement.In R2025a: You can use the
lhsandrhsfunctions to get the left and right sides of a symbolic equation that includes a piecewise expression.
Version History
Introduced in R2016b
See Also
and | assume | assumeAlso | assumptions | if | in | isAlways | not | or
