朱利安.姜:将一个离散时间信号进行傅立叶变换,怎样用MATLAB求该傅立叶变换中包含的频率值?

来源:百度文库 编辑:神马品牌网 时间:2024/04/29 16:39:28
实际上将这个离散时间信号用origin进行傅立叶变换后可以得到频率,但不知它的原理

基本思路是用fft做傅立叶变换,然后画出频谱图,其中的极值处就是频率值。比如下面这个例子,一个22hz的信号。
%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;

有origin这个函数么?偶的7.1的help里找到的类似的指令只有originui
——Interactively modify map origin——作用是改变图像的原点的说...
要进行傅立叶变换是fft的说
可参照陈怀琛等人编的《MATLAB及在电子信息课程中的应用》电子工业出版社第199页离散傅立叶变换DFT
相关命令是fft和ifft——一维快速正逆傅立叶变换函数,可直接调用