Fourier-Transform
Sat 17 May 2025
title: "Fourier Transform" author: "Raja CSP Raman" date: 2019-05-06 description: "-" type: technical_note draft: false
from scipy.fftpack import fft
import numpy as np
x = np.array([1, 2, 3, 4])
x
array([1, 2, 3, 4])
y = fft(x)
y
array([10.+0.j, -2.+2.j, -2.+0.j, -2.-2.j])
import matplotlib.pyplot as plt
plt.plot(x, y, 'ro')
plt.axis([-5, 20, -5, 20])
plt.show()
/Users/rajacsp/anaconda3/envs/py36/lib/python3.6/site-packages/numpy/core/numeric.py:538: ComplexWarning: Casting complex values to real discards the imaginary part
return array(a, dtype, copy=False, order=order)

Score: 5
Category: scipy