Time Reversal of signals: a simple illustration


/ Published in: Python
Save to your folder(s)

A simple code for visualizing time reversal in signals


Copy this code and paste it in your HTML
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Mon Aug 11 18:50:51 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 = 145
  15. nvec = np.linspace(-N+1, N-1, num=N)
  16. y1 = cos(2.0*pi*nvec/N)
  17. #clf()
  18. plt.plot(nvec,y1,label="Original")
  19.  
  20. y1_reverse = cos(-2.0*pi*nvec/N)
  21. plt.plot(nvec,y1_reverse,label="Reversed")
  22. plt.xlabel('time')
  23. plt.ylabel('Signal')
  24. legend(bbox_to_anchor=(.5, .9), loc=1, borderaxespad=0.)
  25. #plt.legend("Original","Time Reversed")

URL: TRSignals_illustration

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.