# Transformada de Fourier de alguns sinais

Neste notebook avaliaremos a transformada de Fourier de alguns sinais. A TF é definida por

\begin{equation}
X(\mathrm{j} \omega)=\int^{\infty}_{-\infty}x(t)e^{-\mathrm{j}\omega t}\mathrm{d}t
\tag{1}
\end{equation}

E a TF inversa por:

\begin{equation}
x(t)=\frac{1}{2 \pi}\int^{\infty}_{-\infty}X(\mathrm{j} \omega)e^{\mathrm{j}\omega t}\mathrm{d}\omega
\tag{2}
\end{equation}


```python
# importar as bibliotecas necessárias
import numpy as np # arrays
import matplotlib.pyplot as plt # plots
plt.rcParams.update({'font.size': 14})
```

### Exemplo 1

$x(t) = \delta(t)$

neste caso 

$X(\mathrm{j} \omega)=1$



```python
freq = np.linspace(-50, 50, 1000)
w = 2*np.pi*freq

Xjw = np.ones(len(w))

plt.figure(figsize=(15, 5))
plt.subplot(1,2,1)
plt.plot(freq, np.abs(Xjw), '-b', linewidth = 2)
plt.grid(linestyle = '--', which='both')
plt.xlabel('Frequência [Hz]')
plt.ylabel(r'$|X(\mathrm{j}\omega)|$ [-]')
plt.xticks(np.arange(freq[0], freq[-1]+10, 10))
plt.xlim((freq[0], freq[-1]))

plt.subplot(1,2,2)
plt.plot(freq, np.angle(Xjw), '-b', linewidth = 2)
plt.grid(linestyle = '--', which='both')
plt.xlabel('Frequência [Hz]')
plt.ylabel(r'$\angle X(\mathrm{j}\omega)$ [rad]')
plt.xticks(np.arange(freq[0], freq[-1]+10, 10))
plt.xlim((freq[0], freq[-1]))
plt.tight_layout()
plt.show()
```

### Exemplo 2

$x(t) = \mathrm{e}^{-at}u(t)$, $a>0$

neste caso 

$X(\mathrm{j} \omega)=\frac{1}{a+\mathrm{j}\omega}$


```python
time = np.linspace(-1, 1, 1000)
xt = np.zeros(len(time))
a = 2
xt[time>=0] = np.exp(-a*time[time>=0])

# Time domain
plt.figure(figsize=(20, 2.5))
plt.plot(time, xt, '-b', linewidth = 2)
plt.grid(linestyle = '--', which='both')
plt.xlabel('Tempo [s]')
plt.ylabel(r'$x(t)$ [-]')
plt.xticks(np.arange(time[0], time[-1]+0.1, 0.1))
plt.xlim((time[0], time[-1]))

# Freq domain
freq = np.linspace(-5, 5, 10000)
w = 2*np.pi*freq

Xjw = 1/(a+1j*w)

plt.figure(figsize=(15, 5))
plt.subplot(1,2,1)
plt.plot(freq, np.abs(Xjw)/np.amax(np.abs(Xjw)), '-b', linewidth = 2)
plt.grid(linestyle = '--', which='both')
plt.xlabel('Frequência [Hz]')
plt.ylabel(r'$|X(\mathrm{j}\omega)|$ [-]')
plt.xticks(np.arange(freq[0], freq[-1]+1, 1))
plt.xlim((freq[0], freq[-1]))
plt.ylim((0, 1.2))

plt.subplot(1,2,2)
plt.plot(freq, np.angle(Xjw), '-b', linewidth = 2)
plt.grid(linestyle = '--', which='both')
plt.xlabel('Frequência [Hz]')
plt.ylabel(r'$\angle X(\mathrm{j}\omega)$ [rad]')
plt.xticks(np.arange(freq[0], freq[-1]+1, 1))
plt.xlim((freq[0], freq[-1]))
plt.tight_layout()
plt.show()
```


```python
time = np.linspace(-5, 5, 1000)
xt = np.ones(len(time))
Tp = 5
xt[time<=-Tp/2] = 0
xt[time>=Tp/2] = 0


# Time domain
plt.figure(figsize=(20, 2.5))
plt.plot(time, xt, '-b', linewidth = 2)
plt.grid(linestyle = '--', which='both')
plt.xlabel('Tempo [s]')
plt.ylabel(r'$x(t)$ [-]')
plt.xticks(np.arange(time[0], time[-1]+1, 1))
plt.xlim((time[0], time[-1]))
```


```python
time = np.linspace(-5, 5, 1000)
xt = np.cos(2*np.pi*time)
Tp = 1
xt[time<=-Tp] = 0
xt[time>=Tp] = 0


# Time domain
plt.figure(figsize=(20, 2.5))
plt.plot(time, xt, '-b', linewidth = 2)
plt.grid(linestyle = '--', which='both')
plt.xlabel('Tempo [s]')
plt.ylabel(r'$x(t)$ [-]')
plt.xticks(np.arange(time[0], time[-1]+1, 1))
plt.xlim((time[0], time[-1]))
```


```python

```

3be5ddbaf4298846ddc4ca4233d19d6e5f36b306
ipynb
Jupyter Notebook
Aula 24 - TF de alguns sinais/.ipynb_checkpoints/TF alguns espectros-checkpoint.ipynb
RicardoGMSilveira/codes_proc_de_sinais
e6a44d6322f95be3ac288c6f1bc4f7cfeb481ac0
CC0-1.0
2020-10-01T20:59:33.000Z
2021-07-27T22:46:58.000Z
Aula 24 - TF de alguns sinais/.ipynb_checkpoints/TF alguns espectros-checkpoint.ipynb
RicardoGMSilveira/codes_proc_de_sinais
e6a44d6322f95be3ac288c6f1bc4f7cfeb481ac0
CC0-1.0
Aula 24 - TF de alguns sinais/.ipynb_checkpoints/TF alguns espectros-checkpoint.ipynb
RicardoGMSilveira/codes_proc_de_sinais
e6a44d6322f95be3ac288c6f1bc4f7cfeb481ac0
CC0-1.0
2020-10-15T12:08:22.000Z
2021-04-12T12:26:53.000Z
Qwen/Qwen-72B
1. YES
2. YES