title: Define a piecewise function with three variables
body: <p>I am trying to define a function in MATLAB according to the following conditions:</p>
  
  <pre><code>If t&lt;0 
       f(t,x,y)=t*(x/y)+1.
  else
       f(t,x,y)=-t*(x/y)+1.
  end
  </code></pre>
  
  <p>I found a way to define a piecewise function in one variable, but here I have three variables. Is there a way to define such a function in MATLAB?</p>