I am trying to figure out how to use the step $u(t)$ and ramp $r(t)$ functions to create the function $f(t)$ below:

$f(x) = \begin{cases}0 & \text{for } t < 0 \\ t & \text{for }-1 \lt t \lt 1 \\ 2 & \text{for }t \gt 1 \end{cases}$

The step function $u(t)$ is defined to be 1 when $t \gt 0$ and $0$ otherwise.

The ramp function $r(t)$ is defined to $t$ for $t \gt 0$ and $0$ otherwise.

So here is my thought process:

$f(t)$ has a line with a slope of 1 from [-1,1]. This looks just like the r(t) function shifted to the left by one. Hence, r(t+1). However, the problem arises after $t = 1$. $r(t+1)$ continues on with a slope of 1 infinitely, but the graph below flattens out at $t=1$. Somehow, I need to cancel out the slope of 1 by adding with a slope of -1. The only way I can get a slope of -1 is by negating $r(t)$ and shifting it to the right by 1.

This yields $r(t+1) - r(t-1)$. This will cancel out the positive slope 1 for t > 1, but this creates a problem on left side because the slope of -1 continues on to negative infinity.

I feel like I'm over thinking this problem.

I would appreciate it if somebody could explain this problem in the simplest possible way.

Also, somebody told me there is an easy way to solve problems like this by looking at where the discontinuities are and where the slopes change. The discontinuities imply using an amplitude with u(t) and slopes imply using amplitude with $r(t)$.

Would appreciate all / any advise.


  • 2
    $\begingroup$ I think you have a typo in $f(x)$. For the range where t= -1 --> 0 , it's supposed to be zero, as well as t. $\endgroup$
    – Dave C
    Feb 11, 2013 at 4:55
  • $\begingroup$ Also, remember that you can use the unit step function $u(t)$ to "turn on" and "turn off" terms in a piecewise manner. What would the plot of $r(t+1)\left(u(t+1) - u(t-1)\right)$ look like? $\endgroup$
    – Jason R
    Feb 11, 2013 at 14:56

1 Answer 1


You have a confilct in your definition for t < 0.

I'm going to assume you mean f(t) = 0 for t < -1, with the rest of the definition unchanged.

The simplest way I can think of doing this is to use u(t) as a tool to switch functions on and off over the desired ranges of time. For example, if you want a function to be on over a range of time, say t1 to t2, multply the function by u(t-t1)-u(t-t2). This turns the function on at t1 and off again at t2.

One representation of your function is:

$$f(t) = [u(t+1)-u(t-1)]t + 2u(t-1)$$

For this representation, we've used two functions: t and the constant function 2. The function t is switch on at t1=-1 and off at t2=1. The constant function '2' is switched on at t2=1 and never switched off.

If you need to use the ramp function instead of t, your function is:

$$f(t) = -[u(t+1)-u(t)]r(-t) + [u(t)-u(t-1)]r(t) + 2u(t-1)$$

Here we've used three functions: -r(-t), r(t) and 2.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.