gt
Define greater than relation
Description
Examples
Set and Use Assumption Using Greater Than
Use assume and the relational operator
> to set the assumption that x is greater than
3:
syms x assume(x > 3)
Solve this equation. The solver takes into account the assumption on variable
x, and therefore returns this solution.
solve((x - 1)*(x - 2)*(x - 3)*(x - 4) == 0, x)
ans = 4
Find Values that Satisfy Condition
Use the relational operator > to set this
condition on variable x:
syms x cond = abs(sin(x)) + abs(cos(x)) > 7/5;
for i = 0:sym(pi/24):sym(pi)
if subs(cond, x, i)
disp(i)
end
endUse the for loop with step π/24 to find angles from 0 to π that satisfy that
condition:
(5*pi)/24 pi/4 (7*pi)/24 (17*pi)/24 (3*pi)/4 (19*pi)/24
Input Arguments
Tips
Calling
>orgtfor non-symbolicAandBinvokes the MATLAB®gtfunction. This function returns a logical array with elements set to logical1 (true)whereAis greater thanB; otherwise, it returns logical0 (false).If both
AandBare arrays, then these arrays must have the same dimensions.A > Breturns an array of relationsA(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. In other words, if
Ais a variable (for example,x), andBis an m-by-n matrix, thenAis expanded into m-by-n matrix of elements, each set tox.The field of complex numbers is not an ordered field. MATLAB projects complex numbers in relations to a real axis. For example,
x > ibecomesx > 0, andx > 3 + 2*ibecomesx > 3.
Version History
Introduced in R2012a