title: How to plot a triangular function and other step functions in Matlab
body: <p>As the title indicates, I want to know how to plot a triangular function in Matlab. e.g.</p>
  
  <pre><code>f(x) = 1-|x| for |x| &lt; 1 and f(x) = 0 otherwise
  </code></pre>
  
  <p>As well as the functions:</p>
  
  <pre><code>Af(x) = A for x &gt;= 0 and Af(x) = 0 for x &lt; 0; -f(x) = -1 for x &gt;= 0 and -f(x) = 0 for x &lt; 0
  </code></pre>