声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 900|回复: 5

[声学基础] 请教matlab-help-fft问题

[复制链接]
发表于 2016-11-29 10:20 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
matlab-help-fft有个例子
Convert a Gaussian pulse from the time domain to the frequency domain.
Define signal parameters and a Gaussian pulse, X.
Fs = 100;           % Sampling frequencyt = -0.5:1/Fs:0.5;  % Time vectorL = length(t);      % Signal lengthX = 1/(4*sqrt(2*pi*0.01))*(exp(-t.^2/(2*0.01)));


Plot the pulse in the time domain.
plot(t,X)title('Gaussian Pulse in Time Domain')xlabel('Time (t)')ylabel('X(t)')



                               
登录/注册后可看大图
To use the fft function to convert the signal to the frequency domain, first identify a new input length that is the next power of 2 from the original signal length. This will pad the signal X with trailing zeros in order to improve the performance of fft.
n = 2^nextpow2(L);


Convert the Gaussian pulse to the frequency domain.
Y = fft(X,n);


Define the frequency domain and plot the unique frequencies.
f = Fs*(0:(n/2))/n;P = abs(Y/n);plot(f,P(1:n/2+1))title('Gaussian Pulse in Frequency Domain')xlabel('Frequency (f)')ylabel('|P(f)|')



                               
登录/注册后可看大图
为什么P=abs(Y/n),我觉得应该是P=2*abs(Y/n)? 试了一下,假如函数y=20*sin(2*pi*0.0006*t)+10*cos(2*pi*0.001*t),求得的振幅确实少了一倍啊???


回复
分享到:

使用道具 举报

发表于 2016-11-29 13:29 | 显示全部楼层
咋还研究这个了呢
 楼主| 发表于 2016-11-29 14:51 | 显示全部楼层
Edinburgh 发表于 2016-11-29 13:29
咋还研究这个了呢

要搞傅里叶变换啊

点评

论坛里很多现成的程序  详情 回复 发表于 2016-11-30 08:28
发表于 2016-11-30 08:28 | 显示全部楼层
xiujuan507 发表于 2016-11-29 14:51
要搞傅里叶变换啊

论坛里很多现成的程序
 楼主| 发表于 2016-11-30 08:33 | 显示全部楼层
minoz 发表于 2016-11-30 08:28
论坛里很多现成的程序

matlab-help里的,怎么看都是错的

点评

应该不能 很权威的  详情 回复 发表于 2016-11-30 13:26
发表于 2016-11-30 13:26 | 显示全部楼层
xiujuan507 发表于 2016-11-30 08:33
matlab-help里的,怎么看都是错的

应该不能  很权威的
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-4-24 16:28 , Processed in 0.091122 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表