You are on page 1of 2

# -*- coding: utf-8 -*"""

Created on Thu Sep 25 20:35:51 2014


@author: Anish
"""
# Importing libraries
import os
os.system('cls')
import numpy as np
import matplotlib.pyplot as plt
import BasicSignals01 as BSig
N1 = 100
nvec1 = np.linspace(-N1, N1, num=2*N1)
N2 = 500
N3 = N2/10
nvec2 = np.linspace(1, N2, num=N3)
delvec = 1/nvec2
t = nvec1/N1
ix = 0
while ix < N3:
delx = delvec[ix]
ix = ix + 1
u_t_p = BSig.fn_ustep(t,delx)
u_t_m = BSig.fn_ustep(t,-delx)
L_del_t = 1/delx*(1-abs(t)/delx)*(u_t_p-u_t_m)
plt.plot(t,L_del_t,'r')
plt.show() # redraw the canvas
pause(.50)

#------------------------------------------------------------------------------------------------------------------# -*- coding: utf-8 -*"""


Created on Sun Sep 21 15:44:07 2014
@author: Anish
"""
import numpy as np
def fn_ramp(t,m,ad):
N = len(t)
y = np.zeros(N)
for i in range(1,N):
if t[i] >= -ad:
y[i] = m*(t[i]+ad)

return y
def fn_ustep(t,ad):
N = len(t)
y = np.zeros(N)
for i in range(1,N):
if t[i] >= -ad:
y[i] = 1
return y

Fig. Traingular pulse approaches an impulse signal (in limit)

You might also like