Posted By

aturlapaty on 08/12/14


Tagged

signals systems


Versions (?)

Shifting signals: a simple illustration


 / Published in: Python
 

URL: Signal Shift: an example

Affect of shifting a signal across the domain

  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Mon Aug 11 19:34:50 2014
  4.  
  5. @author: Anish
  6. """
  7.  
  8. # Importing libraries
  9. import os
  10. os.system('cls')
  11. import numpy as np
  12. import matplotlib.pyplot as plt
  13.  
  14. N = 100
  15. a = .5 #scale parameter
  16. nvec = np.linspace(-N+1, N-1, num=N)
  17. y1 = (exp(-(nvec*.01)**2/.01))
  18. #clf()
  19. plt.plot(nvec,y1,label="Original")
  20.  
  21. y1_shift = exp(-((nvec-N/2)*.01)**2/.01 )
  22.  
  23. plt.plot(nvec,y1_shift,'r',label="Shifted")
  24. plt.xlabel('time')
  25. plt.ylabel('Signal')
  26. legend(bbox_to_anchor=(.5, .9), loc=1, borderaxespad=0.)
  27. #plt.legend("Original","Time Reversed")

Report this snippet  

You need to login to post a comment.