MATLAB中fft的频率轴怎么计算?

下面是MATLAB演示程序中的一段关于FFT的代码。Firstcreatesomedata.Considerdatasampledat1000Hz.Startbyform... 下面是MATLAB演示程序中的一段关于FFT的代码。
First create some data. Consider data sampled at 1000 Hz. Start by forming a time axis for our data, running from t=0 until t=.25 in steps of 1 millisecond. Then form a signal, x, containing sine waves at 50 Hz and 120 Hz.

t = 0:.001:.25;
x = sin(2*pi*50*t) + sin(2*pi*120*t);

%%
% Add some random noise with a standard deviation of 2 to produce a noisy
% signal y. Take a look at this noisy signal y by plotting it.

y = x + 2*randn(size(t));
plot(y(1:50))
title('Noisy time domain signal')

%%
% Clearly, it is difficult to identify the frequency components from looking at
% this signal; that's why spectral analysis is so popular.
%
% Finding the discrete Fourier transform of the noisy signal y is easy; just
% take the fast-Fourier transform (FFT).

Y = fft(y,256);

%%
% Compute the power spectral density, a measurement of the energy at various
% frequencies, using the complex conjugate (CONJ). Form a frequency axis for
% the first 127 points and use it to plot the result. (The remainder of the 256
% points are symmetric.)

Pyy = Y.*conj(Y)/256;
f = 1000/256*(0:127); =====================【问】这个频率轴是怎么运算的??为什么要在前面*1000/256?还有为什么只取前面一半的点??
plot(f,Pyy(1:128))
title('Power spectral density')
xlabel('Frequency (Hz)')

%%
% Zoom in and plot only up to 200 Hz. Notice the peaks at 50 Hz and 120 Hz.
% These are the frequencies of the original signal.

plot(f(1:50),Pyy(1:50))
title('Power spectral density')
xlabel('Frequency (Hz)')
展开
 我来答
huxuec
2009-04-18 · TA获得超过2625个赞
知道小有建树答主
回答量:1095
采纳率:75%
帮助的人:573万
展开全部
表示采样频率是信号本身频率的二倍
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式