Logical OR for symbolic expressions
Combine these symbolic inequalities into a logical condition by using
syms x y xy = x>=0 | y>=0;
Set the assumption represented by the condition using
Verify that the assumptions are set.
ans = 0 <= x | 0 <= y
Combine two symbolic inequalities into a logical expression by using
range = x < -1 | x > 1;
Although the inequalities have values,
subs does not evaluate them
x1 = subs(range,x,10) x2 = subs(range,x,0)
x1 = 1 < 10 | 10 < -1 x2 = 0 < -1 | 1 < 0
Evaluate the inequalities by using
ans = logical 1
ans = logical 0
Combine multiple conditions by applying
the conditions using the
Set the condition that
x equals an integer between
syms x cond = fold(@or, x == 1:10); assume(cond) assumptions
ans = x == 1 | x == 2 | x == 3 | x == 4 | x == 5 |... x == 6 | x == 7 | x == 8 | x == 9 | x == 10
Operands, specified as symbolic equations, inequalities, expressions, or arrays.
B must either be the same size or
have sizes that are compatible (for example,
A is an
N matrix and
B is a
N row vector). For more
information, see Compatible Array Sizes for Basic Operations.
Behavior changed in R2016b
Starting in R2016b with the addition of implicit expansion, some combinations of
arguments for basic operations that previously returned errors now produce results. For
example, you previously could not add a row and a column vector, but those operands are now
valid for addition. In other words, an expression like
[1 2] + [1; 2]
previously returned a size mismatch error, but now it executes.
If your code uses element-wise operators and relies on the errors that MATLAB® previously returned for mismatched sizes, particularly within a
catch block, then your code might no longer
catch those errors.
For more information on the required input sizes for basic array operations, see Compatible Array Sizes for Basic Operations.