import numpy as np from matplotlib import pyplot as plt # fonction qui affiche sin(w.t) avec t entre 0 et 2*pi def plot_sin(nb_x, w=1., style='b-'): x = np.linspace(0.,2*np.pi,nb_x) plt.plot(x, np.sin(w*x), style ) plt.show() # effets de la discretisation assez = 101 plot_sin(assez) peu = 5 plot_sin(peu) plot_sin(peu, style='+') plot_sin(assez) w = 5*np.pi plot_sin(assez,w) beaucoup = 1001 plot_sin(beaucoup,w) # plusieurs 'plot' en partant du plus simple all_x = np.linspace(0, 2*np.pi, beaucoup) all_s = np.sin(0.5*w*all_x) plt.plot(all_s) plt.show() plt.plot(all_x, all_s) plt.show() plt.plot(all_x, all_s, 'r') plt.show() all_c = np.cos(all_x) plt.plot(all_x, all_s, label='sin') plt.plot(all_x[::2], all_c[::2], label='cos') plt.legend() plt.show() #plt.xlabel(xlabel) #plt.ylabel(ylabel) #plt.title( title+equation )