Search code examples
matlabsymbolic-math

Assigning Numeric Range to MATLAB Symbols


I have constant symbols such as

t = sym('t')
c = sym ('c') 

but I have to restrict these symbols with a constraint stating that t is between 0 and 1 (greater equal to zero, smaller equal to one). For c just greater and equal to zero.

I can easily assign a number in matlab by just denoting

t = 0; 

but I need help to put these symbols in an interval.


Solution

  • assume(t > 0);
    assumeAlso(t < 1);
    

    Then, you can decide things like

    isAlways(t^2 < 1)
    

    For the > 0 part, you can use the abbreviation

    c = sym('c', 'positive')