Код: Выделить всё
#import necessary libraries
import numpy as np
import matplotlib.pyplot as plt
import time
#create a signal
L = 10 #length of domain
n = 2048 # number of points
t = np.linspace(0,L,num=n) #domain variable
St = (3*np.sin(2*t)+1.5*np.sin(5*t)+6*np.cos(20*(t))) #signal
#create a function to be plotted on top of the previous signal
m = 100 #number of points
tau = np.linspace(0,L,m) #iteration variable
#create a figure
plt.figure
#slide the new function over the signal
#show the result of each iteration on the same figure
for i in range(len(tau)):
#define the new function
#Define Gabor window/Gaussian
tslide = t-tau[i]
width = 10
g = np.exp(-(width*tslide)**2)
#plot the signal and the sliding function
plt.plot(t, St,color = 'k')
plt.plot(t, g,color = 'r')
time.sleep(0.1)
plt.show()
Спасибо.
Подробнее здесь: https://stackoverflow.com/questions/786 ... e-in-pyhto