Main Content

ge

Define greater than or equal to condition

Description

A >= B creates the condition greater than or equal.

example

ge(A,B) is equivalent to A >= B.

Examples

collapse all

Set the assumption that x is greater than or equal to 3 by using assume.

syms x
assume(x >= 3)

Solve this equation involving 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 =
 3
 4

Set the condition abs(sin(x)) >= 1/2.

syms x
cond = abs(sin(x)) >= 1/2;

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
end
pi/6
pi/4
pi/3
(5*pi)/12
pi/2
(7*pi)/12
(2*pi)/3
(3*pi)/4
(5*pi)/6

Input Arguments

collapse all

Input, specified as a number, vector, matrix, or array, or a symbolic number, variable, array, function, or expression.

Input, specified as a number, vector, matrix, or array, or a symbolic number, variable, array, function, or expression.

Tips

  • Calling >= or ge for non-symbolic A and B invokes the MATLAB® ge function. This function returns a logical array with elements set to logical 1 (true) where A is greater than or equal to B; otherwise, it returns logical 0 (false).

  • If both A and B are arrays, then these arrays must have the same dimensions. A >= B returns an array of relations A(i,j,...) >= B(i,j,...)

  • If one input is scalar and the other an array, then the scalar input is expanded into an array of the same dimensions as the other array.

  • The field of complex numbers is not an ordered field. MATLAB projects complex numbers in relations to a real axis. For example, x >= i becomes x >= 0, and x >= 3+2*i becomes x >= 3.

Version History

Introduced in R2012a