MATLAB: How can I plot a unit step function

plotting functionsunit step function

How can i plot a unit step function or a piecewise function in Matlab?
ie:
h(t)=u(t-2)-u(t-4)?
or another example:
h(t)={0 for t<0, 1 for 2<t<3, 0 for t>3
Also, how can i plot a periodic square wave with thresholds in matlab?

Best Answer

The unit step function is also knoiwn as the heaviside step function.
Related Question