#Importation bibliothèques
import numpy as np
import matplotlib.pyplot as plt

from scipy import signal
from math import pi,cos


####

Um=4

f=???
r=???
n=2

Npt=1000
tmin=0
tmax=1/f
t=np.linspace(tmin,tmax,Npt)

u = 1+Um*signal.square(2*pi*f*t,r)


#### Calcul de la valeur moyenne du signal u

u_mean = [np.mean(u)]*Npt
ualt= ???


######Graphe

plt.figure(0)


plt.plot(t,u,"k-",label="u")
plt.plot(t,u_mean, "k", label='Composante continue',linestyle=':')
plt.plot(t,ualt,"k--", label='Composante alternative')
plt.legend()
plt.title('Représentation temporelle théorique')
plt.xlim(tmin, tmax)
plt.ylim(1.1*min(ualt), 1.1*max(u))

plt.xlabel('t en seconde')
plt.ylabel('Tension en volt')

plt.grid(b=True, which='major',axis="both", color='black', linestyle='-')
plt.grid(b=True, which='minor',axis='both', color='grey', linestyle='--')


plt.show()








