# Confusion with Heaviside Step Function and Ramp Function.

I want to know how to represent the following graph with Heaviside step functions and ramp functions.

My guess is that this is represented as $r(t) -r(t-2) +2u(t-2)$, where $r(t)$ is the unit ramp function and $u(t)$ is the Heaviside unit step function. If this is true then since the delayed ramp function is $r(t-a) = (t-a)u(t-a)$ (according to here) then the same graph can also be represented as $tu(t) -(t-2)u(t-2) +2u(t-2)$. However i draw this function in Matlab and it shows something else instead. I've very confused with this type of problem for a long time now. I don't know what i'm doing wrong. What is the connection between $r(t)$ and $u(t)$? Please help. Thanks in advance!

If we define the ramp function $r$ as

$$r(t)= \begin{cases} t, & t\ge 0\\\\ 0, & t<0 \end{cases}$$

then the function $f$ plotted in the post can be represented as

$$f(t)=r(t)-r(t-2)$$

Note that if one introduces (i.e., adds) a step function, the resulting plot would exhibit a jump discontinuity. Inasmuch as the plot exhibits no jump, then the function it represents can have no such step function.

• I've tested it. Now everything works. That was bothering me for a long time and as it turns out one of my teachers gave me a wrong answer to this! That and then Matlab confused me. Thank you very much! You saved me! I feel so relieved. Aug 22, 2015 at 21:50
• One more thing if you could answer please. The derivative $\frac{d\ r(t-a)}{dt} = u(t-a)$? Is this true? Aug 22, 2015 at 22:02
• You are quite welcome. My pleasure. And yes, the derivative of the unit ramp is the unit step, except of course at $t=0$. At zero, the ramp's derivative is undefined. Aug 22, 2015 at 22:09