职位关键字 工作地点
工作名称 公司名称 校园招聘
中国最好的工作搜索引擎!
  回复留言  
  请教matlab高手!
作者: 上下求索_quest  01-01 08:00   回复  
 请看下面一段关于快速傅利叶变换的程序:



%generate the time index

sampling_rate = 100;

t1 = 0:1/sampling_rate:3-1/sampling_rate;

t2 = 3+1/sampling_rate:1/sampling_rate:6;

t = [t1 t2];



%determine the frequency of the input signal

F1 = 2;

F2 = 8;



temp1 = sin(2*F1*pi*t1);

temp2 = sin(2*F2*pi*t2);



%generate the signals

x1 = [temp1 temp2];



%apply the FFT transform on the input signals

y1 = fft(x1);



%plot the input signal

plot(t, x1); grid on; xlabel('time (seconds)'); ylabel('Magnitude');



%generate the frequency index

f = (0:length(y1)-1)'*sampling_rate/length(y1);



%plot the frequency components of the input signal

plot(f(1:length(f)/2), abs(y1(1:length(y1)/2)));

xlabel('Frequency (Hz)'); ylabel('Abs. Magnitude'); grid on;



请问f = (0:length(y1)-1)'*sampling_rate/length(y1); 这段程序是如何将横轴坐标转变成频率为刻度的?原理应该怎样解释?

  回复:请教matlab高手!
作者: legendbb  01-01 08:00   回复  
 %generate the frequency index

f = (0:length(y1)-1)'*sampling_rate/length(y1);



plot(x,y)

x的原始值就是频率,没有另外的转换。

标 题:
内 容:
用户名:
 游客
 
 
Copyright©2005-2007, 版权所有 WWW.JOBMET.COM
ICP证:京ICP备06019556号