Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

MATLAB FFT question

  1. Jun 16, 2013 #1

    I am hoping someone can give me some advice. I need to zero out the DC component of an FFT I have done, so I can get a better look at the rest of the frequency components, so how would one go about doing that?

    I am not looking the code, just some advice ...I have just really started learning MATLAB for work, so any help would be great.

    Thanks in advance.
  2. jcsd
  3. Jun 16, 2013 #2


    User Avatar
    Science Advisor
    Gold Member

    I suppose this depends on what exactly your "DC component" is.

    The obvious answer, surely, is, after you have the FFT output in an array, is to identify which element of the array contains the DC component and set it equal to zero. If the "DC component" is actually spread over a small number of elements, set all of them zero.

    If your problem is simply that the vertical scale of the graph is wrong for you to see the details you want, you have two other options:
    1. Interactively use the "magnifier glass" tool in the plot window to zoom in to the area of interest
    2. Programmatically learn how to use the axis command
    If your "DC component" actually spreads out over a very large number of elements, you have a bigger problem...
  4. Jun 16, 2013 #3
    Hi, thanks for the reply!

    I think zeroing the bin that has the frequency of the DC component is the best way to work it, I will try that.

    Can't believe I didn't think of that haha.

    I have used the 'axis' command for a few scaling problems, but I think setting the elements to zero will do that trick.

Share this great discussion with others via Reddit, Google+, Twitter, or Facebook