Define less than or equal to condition
le( A , B ) is equivalent to A
Set the assumption that x is less than or equal to 3 by using assume .
syms x cond = xSolve an equation for x . The solver only returns solutions that are valid under the assumption on x .
eqn = (x-1)*(x-2)*(x-3)*(x-4) == 0; solve(eqn,x)ans = 1 2 3Find Values that Satisfy Condition
Set the condition abs(sin(x))
syms x cond = abs(sin(x))Find multiples of π/24 that satisfy the condition by using a for loop from 0 to π.
for i = 0:sym(pi/12):sym(pi) if subs(cond, x, i) disp(i) end end0 pi/12 pi/6 (5*pi)/6 (11*pi)/12 piInput Arguments
A — Input
number | vector | matrix | array | symbolic number | symbolic variable | symbolic array | symbolic function | symbolic expressionInput, specified as a number, vector, matrix, or array, or a symbolic number, variable, array, function, or expression.
B — Input
number | vector | matrix | array | symbolic number | symbolic variable | symbolic array | symbolic function | symbolic expressionInput, specified as a number, vector, matrix, or array, or a symbolic number, variable, array, function, or expression.
Tips
Introduced in R2012a
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:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.