How to Compute FFT and Plot Frequency Spectrum in Python using Numpy and Matplotlib

Sdílet
Vložit
  • čas přidán 10. 09. 2024
  • In this video, I demonstrated how to compute Fast Fourier Transform (FFT) in Python using the Numpy fft function. Plotting the frequency spectrum using matplotlib is also shown. It would be great if you can give me some feedbacks. Thanks for watching!

Komentáře • 64

  • @eefunhuang6958
    @eefunhuang6958 Před rokem +6

    Thank you! The DC point I think it’s because it doesn’t have the negative or the complex conjugate component to add up the amplitude, so it doesn’t need to double

  • @arirajuh
    @arirajuh Před 3 lety +3

    Thank you for the learning steps.
    Goal
    Construct
    Perform or Compute
    Plot : Show case of time domain signals

  • @MrELMOSAFER
    @MrELMOSAFER Před 2 měsíci +1

    Thank you. The explanation is good and some parts can be understood from it, but the variable names are very confusing and the code cannot be understood if you look at it without the explanation especially for beginners in this field of programing

  • @cdevagiri
    @cdevagiri Před rokem +1

    Thank you so much. Very helpful. Now I understand why the magnitude doubles when converting from double-sided spectrum to single sided one

  • @WACkZerden
    @WACkZerden Před rokem +1

    thank You for showing how to perform FFT in Python. this is helping me understand it better

  • @JJGhostHunters
    @JJGhostHunters Před 11 měsíci +4

    Great content! I wish I could find an example of a real time signal with an unknown "frequency" instead of a contrived sine wave signal. With a contrived signal the time divisions are established automatically. Maybe I am missing something.

  • @whitehackeryoon7844
    @whitehackeryoon7844 Před 3 lety +3

    You really help me to finish my thesis haha. Thanks man👨‍💻👨‍💻

  • @SLguitarGuy
    @SLguitarGuy Před 3 lety +3

    Very nice❤I hope U'll reach 1 million views for this

  • @raspicc
    @raspicc Před rokem +1

    Me sirvió bastante, muchísimas gracias saludos desde Perú.

  • @cerita-ceritanabi3343
    @cerita-ceritanabi3343 Před rokem +1

    Hi, I want to analyze an SNR using a CSV file. I want no the signal from 0-200 Hz. In CSV file only has the data on G. What should I do for SNR analysis?

  • @user-xc9pp4tf3f
    @user-xc9pp4tf3f Před rokem +1

    Awesome teaching thank you, but I do not understand why you use (N-1)*tstep in time step instead of (N) * tstep?

  • @davidsalazar154
    @davidsalazar154 Před rokem +1

    Thank you so much ! Easy to understand and aplicate !

  • @baghdadiabdellatif1581
    @baghdadiabdellatif1581 Před 9 měsíci +1

    Thank you

  • @UsamaAhmedZeki
    @UsamaAhmedZeki Před 2 lety +1

    Thank you, Absolutely beautiful.

  • @hectorsanchezsantillan7190

    Thank you, this tutorial Is gold

  • @hrudaideepthi3346
    @hrudaideepthi3346 Před 3 lety +2

    Very informative

  • @mikefredd3390
    @mikefredd3390 Před 2 lety

    Great summary of fft() !

  • @WACkZerden
    @WACkZerden Před rokem +1

    very helpful

  • @gajulasrimannrayana3245

    Thanks a lot, clarifying fft

  • @prasannagururajan5056
    @prasannagururajan5056 Před 2 lety

    Great explanation - thanks

  • @scottmather6441
    @scottmather6441 Před 2 lety

    How could I change it to plotting incoming data from a COM port? Thanks!

  • @bodireddigarimythilireddy1459

    Y we are having negative values in time domain signal ..in the final output picture

  • @yoyoke1
    @yoyoke1 Před rokem +1

    Nice!

  • @ChrisYSmithY
    @ChrisYSmithY Před 2 lety

    very good demo! Thank you!

  • @doditsuprianto6474
    @doditsuprianto6474 Před 2 lety

    good explaination. good job. Thanks

  • @rishisurya6008
    @rishisurya6008 Před 3 lety +3

    For which signal you have done this, how can i insert a audio signal to apply fft algorithm ?

    • @sujoymondal7511
      @sujoymondal7511 Před 2 lety

      Follow this channel for your question
      czcams.com/video/ELPlzXNAp34/video.html

  • @nb664rbk
    @nb664rbk Před 2 lety +1

    Why the number of samples N = Fs/F0? Is there a mathematical reason behind it or just because you need an upper bound for your intervals?

    • @prasannagururajan5056
      @prasannagururajan5056 Před 2 lety +2

      Sampling frequency is 2000
      Period = 1/2000 = 0.005 which is the time taken for 1 cycle to complete
      Signal frequency = 100
      Period = 1/100 = 0.01
      The period (time) corresponding to signal frequency can be divided between 0 to 0.01. This is the time boundary
      Next question is how many time intervals of 0.005 is between 0 to 0.01 = 20
      Other way of saying is
      How many samples can be taken at sampling frequency of 2000 considering the period of 0.01
      = 2000 * .01 or 2000/100 = 20
      20 samples can be taken at the time interval between 0 sec to 0.01 secs.
      Therefore this period is divided in to 20 , 1 per sample.

  • @scottmather6441
    @scottmather6441 Před 2 lety

    Thank you very much!

  • @nuclierrobin5272
    @nuclierrobin5272 Před 2 lety +1

    Is fstep = f0 because fstep = fs/n and n= fs/f0 so that means fstep = fs/fs/f0

  • @et4493
    @et4493 Před 2 lety

    what if I don't know the frequency of the function (i.e. it is a non-periodic function)?

    • @robytoby1544
      @robytoby1544 Před rokem +1

      input the data and run the fft, the point of the fft is to break up a function into its constituent sine wave functions without knowing frequencies.

  • @Mephysto9292
    @Mephysto9292 Před 3 lety +2

    nice !

  • @jahanvichaudhary81
    @jahanvichaudhary81 Před 2 lety

    Thank you so much

  • @noviaantika5276
    @noviaantika5276 Před 2 lety +1

    Hi, I've tried your numpy fft code using rectangular function input and the result is not as expected. It is different from your previous video with sin function (analytical function) for rectangular function. Would you check it?

    • @1mviews876
      @1mviews876  Před 2 lety

      pls share your code

    • @sujoymondal7511
      @sujoymondal7511 Před 2 lety

      Follow this channel for updates czcams.com/video/ELPlzXNAp34/video.html

  • @jitendrapagare8970
    @jitendrapagare8970 Před 2 lety

    Which software have you used

  • @liamgaeuman4990
    @liamgaeuman4990 Před rokem

    fstep is just f0? is that right?

  • @Waterlmelon
    @Waterlmelon Před 2 lety

    good video thanks

  • @Seff2
    @Seff2 Před 3 lety +2

    very usefull. What do you mean with DC component?

    • @1mviews876
      @1mviews876  Před 3 lety +1

      It means 0Hz or you can think of it as the average of the signal.

  • @panosp5711
    @panosp5711 Před 2 lety

    How plt.plot() calculates in which frequency, each magnitude belongs?

    • @sujoymondal7511
      @sujoymondal7511 Před 2 lety

      Follow the link czcams.com/video/ELPlzXNAp34/video.html

  • @kevinshao9148
    @kevinshao9148 Před 2 lety +1

    Thanks for the great video! One question at 7:21, what is it to divide by len(time series)? Thank you!

    • @kevinshao9148
      @kevinshao9148 Před 2 lety

      Hi could you please help with my question above?

    • @SimeonPlays
      @SimeonPlays Před 2 lety +2

      it divides by how many times he counts the time series

    • @kevinshao9148
      @kevinshao9148 Před 2 lety +1

      @@SimeonPlays Thank you so much for your reply! Let me to refresh my memory and try to understand what you explain.

  • @code2compass
    @code2compass Před 10 měsíci

    What is the purpose of N-1

  • @fajryadir332
    @fajryadir332 Před 3 lety

    thanks dude

  • @mohanraj411
    @mohanraj411 Před 3 lety +1

    Thanks for ur video.Can u try the same without fft inbuilt function.

    • @1mviews876
      @1mviews876  Před 3 lety

      Yes, it is possible. You may simplify refer to the definition of FFT or DFT. I believe Numpy is doing the same internally, they just put a wrapper for users.

  • @rupeshkadam7600
    @rupeshkadam7600 Před 3 lety +3

    Very informative and great explanation. Can you make full tutorial on Numpy and Scipy?
    Because this tutorial I got interest in this.
    Thank you!

    • @1mviews876
      @1mviews876  Před 3 lety

      There are already quite some good videos about Numpy and Scipy out there. Tks for your comment ;)

  • @robertovalenzuela8860
    @robertovalenzuela8860 Před 3 lety

    'numpy.ndarray' object has no attribute 'plot' :O

  • @excelsior2229
    @excelsior2229 Před 3 lety +1

    Can you send the code please

    • @1mviews876
      @1mviews876  Před 3 lety +1

      you may pause it video and type the codes by yourself. there're only a few lines :)

    • @sujoymondal7511
      @sujoymondal7511 Před 2 lety

      Another demo and code can be found in czcams.com/video/ELPlzXNAp34/video.html

  • @TypicallyThomas
    @TypicallyThomas Před rokem

    This is honestly one of the least helpful tutorials I've ever seen

  • @gunjan6652
    @gunjan6652 Před měsícem

    Thank You

  • @user-ri8zl1tt7q
    @user-ri8zl1tt7q Před 2 lety

    thank you