/ Published in: Python
A simple code for visualizing time reversal in signals
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
# -*- coding: utf-8 -*- """ Created on Mon Aug 11 18:50:51 2014 @author: Anish """ # Importing libraries import os os.system('cls') import numpy as np import matplotlib.pyplot as plt N = 145 nvec = np.linspace(-N+1, N-1, num=N) y1 = cos(2.0*pi*nvec/N) #clf() plt.plot(nvec,y1,label="Original") y1_reverse = cos(-2.0*pi*nvec/N) plt.plot(nvec,y1_reverse,label="Reversed") plt.xlabel('time') plt.ylabel('Signal') legend(bbox_to_anchor=(.5, .9), loc=1, borderaxespad=0.) #plt.legend("Original","Time Reversed")