# Evaluation of step functions

Discussion in 'Math' started by smarch, Nov 20, 2010.

1. ### smarch Thread Starter Active Member

Mar 14, 2009
52
0
I am asked to evaluate this combination of step functions, though I have no idea what to do with it.
Anyone have any information on these types of problems or know what to do with it?

x(t) = t^2.u(t) - t^2.u(t-1) + (t-2)^2.u(t-1) - u(t-3)

Thanks.

Mar 14, 2009
52
0

3. ### mik3 Senior Member

Feb 4, 2008
4,846
63
A step function equals to 1 for t>=0. Assign values to t and see at which part u(t-x)>=0.

4. ### Georacer Moderator

Nov 25, 2009
5,151
1,266
As mik3 said, make a timeline and for each time sample (step) evaluate your function x(t) at that point.

Jul 7, 2009
1,585
141
Here's a python program that will evaluate the function if you think it's too much trouble to make a plot by hand:

Code ( (Unknown Language)):
1.
2. from __future__ import division
3. from pylab import *
4.
5. def function(t):
6.     u = lambda t: 1 if t >=0 else 0
7.     return t**2*u(t) - t**2*u(t-1) + (t-2)**2*u(t-1) - u(t-3)
8.
9. n, a = 1000, 4
10. T, y = arange(-a, a, a/n), []
11. for t in T:
12.     y.append(function(t))
13. plot(T, y)
14. grid(True)
15. show()
16.
You'll need numpy and matplotlib to make the plot. u is the unit step function; there are different definitions floating around, so make sure you use the one your teacher wants you to use.