``````

In [ ]:

%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt

``````
``````

In [ ]:

#Termos de Fourier
N = 100

#Frequencia do sinal e de corte
f_c = 500 #Hz
f = 50 #Hz
w_c = f_c * (2 * np.pi)
w = f * (2 * np.pi)

V_0 = 10 #V

#Período da simulação
T = 1 / f #s

#Número de passos temporais
n = int(1e4)
t = np.linspace(0, T, n)

``````
``````

In [ ]:

#Fourier
A = 4 * V_0 / np.pi

V = np.zeros((n, 1))
Vf = np.zeros((n, 1))

for j in range(n):
for i in range(N):
k = 1 + 2*i
V[j] += A * np.sin(k * w * t[j]) / k

#Tensao de saida
for i in range(N):
k = 1 + 2*i
w_i = w * k

G_0 = 1 / np.sqrt(1 + (w_i / w_c) ** 2)
phi_0 = np.arctan(-w_i / w_c)

for j in range(n):
Vf[j] += G_0 * A * np.sin(w_i * t[j] + phi_0) / k

``````
``````

In [ ]:

plt.plot(t, V, 'b', label='Tensão de entrada')
plt.plot(t, Vf, 'r', label='Tensão de saida')
plt.legend()
desc = "\$N=%s, V_0=%s, f=%s Hz, f_c =%s Hz, T=%s s\$" % (N, V_0, f, f_c, T)
plt.title("Efeito de um filtro passa baixa\n%s" % desc)
plt.xlabel("Tempo (s)")
plt.ylabel("Tensão (V)")
plt.xlim(0, np.max(t))
plt.show()

``````
``````

In [ ]:

``````