Evaluation of step functions

Thread Starter

smarch

Joined Mar 14, 2009
52
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.
 

someonesdad

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

Rich (BB code):
from __future__ import division
from pylab import *

def function(t):
    u = lambda t: 1 if t >=0 else 0
    return t**2*u(t) - t**2*u(t-1) + (t-2)**2*u(t-1) - u(t-3)

n, a = 1000, 4
T, y = arange(-a, a, a/n), []
for t in T:
    y.append(function(t))
plot(T, y)
grid(True)
show()
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.
 
Top