~Example:
To define an expression like this:
You can use the piecewise command:
syms x
y = piecewise(x < 0, 1, x > 0, -1)Using otherwise:

syms y(x)
y(x) = piecewise(x < -2,-2,(-2 < x) & (x < 0),0,1)Search
Oct 01, 20241 min read
To define an expression like this:
You can use the piecewise command:
syms x
y = piecewise(x < 0, 1, x > 0, -1)Using otherwise:

syms y(x)
y(x) = piecewise(x < -2,-2,(-2 < x) & (x < 0),0,1)