帮我理解FFT函数(Matlab)

时间:2021-09-08 03:10:22

1) Besides the negative frequencies, which is the minimum frequency provided by the FFT function? Is it zero?
2) If it is zero how do we plot zero on a logarithmic scale?
3) The result is always symmetrical? Or it just appears to be symmetrical?
4) If I use abs(fft(y)) to compare 2 signals, may I lose some accuracy?

1)除了负频率,这是FFT函数提供的最小频率?它是零吗? 2)如果它为零,我们如何在对数标度上绘制零? 3)结果总是对称的?或者它看似是对称的? 4)如果我使用abs(fft(y))来比较2个信号,我可能会失去一些准确度吗?

5 个解决方案

#1


1) Besides the negative frequencies, which is the minimum frequency provided by the FFT function? Is it zero?

1)除了负频率,这是FFT函数提供的最小频率?它是零吗?

fft(y) returns a vector with the 0-th to (N-1)-th samples of the DFT of y, where y(t) should be thought of as defined on 0 ... N-1 (hence, the 'periodic repetition' of y(t) can be thought of as a periodic signal defined over Z).

fft(y)返回y的DFT的第0到第(N-1)个样本的向量,其中y(t)应该被认为是在0 ... N-1上定义的(因此, y(t)的“周期性重复”可以被认为是在Z上定义的周期信号。

The first sample of fft(y) corresponds to the frequency 0. The Fourier transform of real, discrete-time, periodic signals has also discrete domain, and it is periodic and Hermitian (see below). Hence, the transform for negative frequencies is the conjugate of the corresponding samples for positive frequencies.

fft(y)的第一个样本对应于频率0.真实的离散时间周期信号的傅里叶变换也具有离散域,并且它是周期性的和Hermitian(见下文)。因此,负频率的变换是正频率的相应样本的共轭。

For example, if you interpret (the periodic repetition of) y as a periodic real signal defined over Z (sampling period == 1), then the domain of fft(y) should be interpreted as N equispaced points 0, 2π/N ... 2π(N-1)/N. The samples of the transform at the negative frequencies -π ... -π/N are the conjugates of the samples at frequencies π ... π/N, and are equal to the samples at frequencies π ... 2π(N-1)/N.

例如,如果您将y(周期性重复)解释为在Z上定义的周期性实信号(采样周期== 1),则fft(y)的域应解释为N等间隔点0,2π/ N. ..2π(N-1)/ N.负频率-π...-π/ N的变换样本是频率为π...π/ N的样本的共轭,并且等于频率为π...2π的样本(N- 1)/ N。

2) If it is zero how do we plot zero on a logarithmic scale?

2)如果它为零,我们如何在对数标度上绘制零?

If you want to draw some sort of Bode plot you may plot the transform only for positive frequencies, ignoring the samples corresponding to the lowest frequencies (in particular 0).

如果您想绘制某种波特图,您可以仅针对正频率绘制变换,忽略对应于最低频率的样本(特别是0)。

3) The result is always symmetrical? Or it just appears to be symmetrical?

3)结果总是对称的?或者它看似是对称的?

It has Hermitian symmetry if y is real: Its real part is symmetric, its imaginary part is anti-symmetric. Stated another way, its amplitude is symmetric and its phase anti-symmetric.

如果y是真的,它具有厄米对称性:它的实部是对称的,它的虚部是反对称的。换句话说,其幅度是对称的并且其相位是反对称的。

4) If I use abs(fft(y)) to compare 2 signals, may I lose some accuracy?

4)如果我使用abs(fft(y))来比较2个信号,我可能会失去一些准确度吗?

If you mean abs(fft(x - y)), this is OK and you can use it to get an idea of the frequency distribution of the difference (or error, if x is an estimate of y). If you mean abs(fft(x)) - abs(fft(y)) (???) you lose at least phase information.

如果你的意思是abs(fft(x - y)),这是可以的,你可以用它来了解差异的频率分布(或误差,如果x是y的估计)。如果你的意思是abs(fft(x)) - abs(fft(y))(???)你至少会丢失相位信息。

#2


Well, if you want to understand the Fast Fourier Transform, you want to go back to the basics and understand the DFT itself. But, that's not what you asked, so I'll just suggest you do that in your own time :)

好吧,如果你想了解快速傅里叶变换,你想回到基础并理解DFT本身。但是,这不是你问的,所以我建议你在自己的时间里做到这一点:)

But, in answer to your questions:

但是,在回答你的问题时:

  1. Yes, (excepting negatives, as you said) it is zero. The range is 0 to (N-1) for an N-point input.
  2. 是的,(除了负面,如你所说)它是零。对于N点输入,范围是0到(N-1)。

  3. In MATLAB? I'm not sure I understand your question - plot zero values as you would any other value... Though, as rightly pointed out by duffymo, there is no natural log of zero.
  4. 在MATLAB中?我不确定我理解你的问题 - 像任何其他值一样绘制零值...尽管正如duffymo正确指出的那样,没有零的自然对数。

  5. It's essentially similar to a sinc (sine cardinal) function. It won't necessarily be symmetrical, though.
  6. 它基本上类似于sinc(正弦基数)函数。但它不一定是对称的。

  7. You won't lose any accuracy, you'll just have the magnitude response (but I guess you knew that already).
  8. 你不会失去任何准确性,你只会得到幅度响应(但我猜你已经知道了)。

#3


Consulting "Numerical Recipes in C", Chapter 12 on "Fast Fourier Transform" says:

咨询“C中的数字配方”,第12章“快速傅立叶变换”说:

  1. The frequency ranges from negative fc to positive fc, where fc is the Nyquist critical frequency, which is equal to 1/(2*delta), where delta is the sampling interval. So frequencies can certainly be negative.

    频率范围从负fc到正fc,其中fc是奈奎斯特临界频率,其等于1 /(2 * delta),其中delta是采样间隔。所以频率肯定是负面的。

  2. You can't plot something that doesn't exist. There is no natural log of zero. You'll either plot frequency as the x-axis or choose a range that doesn't include zero for your semi-log axis.

    你不能绘制不存在的东西。没有零的自然对数。您可以将频率绘制为x轴,也可以选择半对数轴不包括零的范围。

  3. The presence or lack of symmetry in the frequency range depends on the nature of the function in the time domain. You can have a plot in the frequency domain that is not symmetric about the y-axis.

    频率范围内是否存在对称性取决于时域中函数的性质。您可以在频域中绘制一个关于y轴不对称的图。

  4. I don't think that taking the absolute value like that is a good idea. You'll want to read a great deal more about convolution, correction, and signal processing to compare two signals.

    我不认为拿这样的绝对值是个好主意。您需要阅读更多有关卷积,校正和信号处理的信息,以比较两个信号。

#4


  1. result of fft can be 0. already answered by other people.
  2. fft的结果可以是0.已经被其他人回答了。

  3. to plot 0 frequency, the trick is to set it to a very small positive number (I use exp(-15) for that purpose).
  4. 绘制0频率,诀窍是将其设置为一个非常小的正数(我为此目的使用exp(-15))。

  5. already answered by other people.
  6. 其他人已经回答了

  7. if you are only interested in the magnitude, yes you can do that. this is applicable, say, in many image processing problems.
  8. 如果你只对幅度感兴趣,是的,你可以做到这一点。例如,这适用于许多图像处理问题。

#5


Half your question:

问题的一半:

3) The results of the FFT operation depend on the nature of the signal; hence there's nothing requiring that it be symmetrical, although if it is you may get some more information about the properties of the signal

3)FFT运算的结果取决于信号的性质;因此没有什么要求它是对称的,尽管如果是这样你可能会得到更多关于信号属性的信息

4) That will compare the magnitudes of a pair of signals, but those being equal do no guarantee that the FFTs are identical (don't forget about phase). It may, however, be enough for your purposes, but you should be sure of that.

4)这将比较一对信号的幅度,但那些相等的信号不能保证FFT是相同的(不要忘记相位)。但是,它可能足以满足您的目的,但您应该确定这一点。

#1


1) Besides the negative frequencies, which is the minimum frequency provided by the FFT function? Is it zero?

1)除了负频率,这是FFT函数提供的最小频率?它是零吗?

fft(y) returns a vector with the 0-th to (N-1)-th samples of the DFT of y, where y(t) should be thought of as defined on 0 ... N-1 (hence, the 'periodic repetition' of y(t) can be thought of as a periodic signal defined over Z).

fft(y)返回y的DFT的第0到第(N-1)个样本的向量,其中y(t)应该被认为是在0 ... N-1上定义的(因此, y(t)的“周期性重复”可以被认为是在Z上定义的周期信号。

The first sample of fft(y) corresponds to the frequency 0. The Fourier transform of real, discrete-time, periodic signals has also discrete domain, and it is periodic and Hermitian (see below). Hence, the transform for negative frequencies is the conjugate of the corresponding samples for positive frequencies.

fft(y)的第一个样本对应于频率0.真实的离散时间周期信号的傅里叶变换也具有离散域,并且它是周期性的和Hermitian(见下文)。因此,负频率的变换是正频率的相应样本的共轭。

For example, if you interpret (the periodic repetition of) y as a periodic real signal defined over Z (sampling period == 1), then the domain of fft(y) should be interpreted as N equispaced points 0, 2π/N ... 2π(N-1)/N. The samples of the transform at the negative frequencies -π ... -π/N are the conjugates of the samples at frequencies π ... π/N, and are equal to the samples at frequencies π ... 2π(N-1)/N.

例如,如果您将y(周期性重复)解释为在Z上定义的周期性实信号(采样周期== 1),则fft(y)的域应解释为N等间隔点0,2π/ N. ..2π(N-1)/ N.负频率-π...-π/ N的变换样本是频率为π...π/ N的样本的共轭,并且等于频率为π...2π的样本(N- 1)/ N。

2) If it is zero how do we plot zero on a logarithmic scale?

2)如果它为零,我们如何在对数标度上绘制零?

If you want to draw some sort of Bode plot you may plot the transform only for positive frequencies, ignoring the samples corresponding to the lowest frequencies (in particular 0).

如果您想绘制某种波特图,您可以仅针对正频率绘制变换,忽略对应于最低频率的样本(特别是0)。

3) The result is always symmetrical? Or it just appears to be symmetrical?

3)结果总是对称的?或者它看似是对称的?

It has Hermitian symmetry if y is real: Its real part is symmetric, its imaginary part is anti-symmetric. Stated another way, its amplitude is symmetric and its phase anti-symmetric.

如果y是真的,它具有厄米对称性:它的实部是对称的,它的虚部是反对称的。换句话说,其幅度是对称的并且其相位是反对称的。

4) If I use abs(fft(y)) to compare 2 signals, may I lose some accuracy?

4)如果我使用abs(fft(y))来比较2个信号,我可能会失去一些准确度吗?

If you mean abs(fft(x - y)), this is OK and you can use it to get an idea of the frequency distribution of the difference (or error, if x is an estimate of y). If you mean abs(fft(x)) - abs(fft(y)) (???) you lose at least phase information.

如果你的意思是abs(fft(x - y)),这是可以的,你可以用它来了解差异的频率分布(或误差,如果x是y的估计)。如果你的意思是abs(fft(x)) - abs(fft(y))(???)你至少会丢失相位信息。

#2


Well, if you want to understand the Fast Fourier Transform, you want to go back to the basics and understand the DFT itself. But, that's not what you asked, so I'll just suggest you do that in your own time :)

好吧,如果你想了解快速傅里叶变换,你想回到基础并理解DFT本身。但是,这不是你问的,所以我建议你在自己的时间里做到这一点:)

But, in answer to your questions:

但是,在回答你的问题时:

  1. Yes, (excepting negatives, as you said) it is zero. The range is 0 to (N-1) for an N-point input.
  2. 是的,(除了负面,如你所说)它是零。对于N点输入,范围是0到(N-1)。

  3. In MATLAB? I'm not sure I understand your question - plot zero values as you would any other value... Though, as rightly pointed out by duffymo, there is no natural log of zero.
  4. 在MATLAB中?我不确定我理解你的问题 - 像任何其他值一样绘制零值...尽管正如duffymo正确指出的那样,没有零的自然对数。

  5. It's essentially similar to a sinc (sine cardinal) function. It won't necessarily be symmetrical, though.
  6. 它基本上类似于sinc(正弦基数)函数。但它不一定是对称的。

  7. You won't lose any accuracy, you'll just have the magnitude response (but I guess you knew that already).
  8. 你不会失去任何准确性,你只会得到幅度响应(但我猜你已经知道了)。

#3


Consulting "Numerical Recipes in C", Chapter 12 on "Fast Fourier Transform" says:

咨询“C中的数字配方”,第12章“快速傅立叶变换”说:

  1. The frequency ranges from negative fc to positive fc, where fc is the Nyquist critical frequency, which is equal to 1/(2*delta), where delta is the sampling interval. So frequencies can certainly be negative.

    频率范围从负fc到正fc,其中fc是奈奎斯特临界频率,其等于1 /(2 * delta),其中delta是采样间隔。所以频率肯定是负面的。

  2. You can't plot something that doesn't exist. There is no natural log of zero. You'll either plot frequency as the x-axis or choose a range that doesn't include zero for your semi-log axis.

    你不能绘制不存在的东西。没有零的自然对数。您可以将频率绘制为x轴,也可以选择半对数轴不包括零的范围。

  3. The presence or lack of symmetry in the frequency range depends on the nature of the function in the time domain. You can have a plot in the frequency domain that is not symmetric about the y-axis.

    频率范围内是否存在对称性取决于时域中函数的性质。您可以在频域中绘制一个关于y轴不对称的图。

  4. I don't think that taking the absolute value like that is a good idea. You'll want to read a great deal more about convolution, correction, and signal processing to compare two signals.

    我不认为拿这样的绝对值是个好主意。您需要阅读更多有关卷积,校正和信号处理的信息,以比较两个信号。

#4


  1. result of fft can be 0. already answered by other people.
  2. fft的结果可以是0.已经被其他人回答了。

  3. to plot 0 frequency, the trick is to set it to a very small positive number (I use exp(-15) for that purpose).
  4. 绘制0频率,诀窍是将其设置为一个非常小的正数(我为此目的使用exp(-15))。

  5. already answered by other people.
  6. 其他人已经回答了

  7. if you are only interested in the magnitude, yes you can do that. this is applicable, say, in many image processing problems.
  8. 如果你只对幅度感兴趣,是的,你可以做到这一点。例如,这适用于许多图像处理问题。

#5


Half your question:

问题的一半:

3) The results of the FFT operation depend on the nature of the signal; hence there's nothing requiring that it be symmetrical, although if it is you may get some more information about the properties of the signal

3)FFT运算的结果取决于信号的性质;因此没有什么要求它是对称的,尽管如果是这样你可能会得到更多关于信号属性的信息

4) That will compare the magnitudes of a pair of signals, but those being equal do no guarantee that the FFTs are identical (don't forget about phase). It may, however, be enough for your purposes, but you should be sure of that.

4)这将比较一对信号的幅度,但那些相等的信号不能保证FFT是相同的(不要忘记相位)。但是,它可能足以满足您的目的,但您应该确定这一点。