0

I try using manim to plot the fourier transform of a function but it gives me this error as i use the fft() method.

from manim import *
from numpy import sin
import numpy as np



class sampling(Scene):
    def construct(self):
        t = np.arange(-2*PI,2*PI,0.01)
        sr = len(t)/(4*PI)
        x=[]
        for i in range(len(t)):
            x.append(sin(t[i]))
        X = np.fft(x)
        N = len(X)
        n = np.arange(N)
        T = N/sr
        freq = n/T

        plane2 = NumberPlane(x_range=[-1,3],y_range=[-1,1],x_length=4,y_length=2).add_coordinates()
        plane2_graph=plane2.plot(np.abs(X/N),freq,color=GOLD_C)

the error that I get:

TypeError: 'module' object is not callable

I was expecting every thing to workout, i don't even understand this error.

Cris Luengo
  • 55,762
  • 10
  • 62
  • 120
  • 1
    Does this answer your question? [TypeError: 'module' object is not callable](https://stackoverflow.com/questions/4534438/typeerror-module-object-is-not-callable) – Dragon Apr 12 '23 at 02:10
  • `np.fft` is not a function, it is a module. Try `np.fft.fft(x)`. – Cris Luengo Apr 12 '23 at 02:20

0 Answers0