声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1269|回复: 0

[FFT] 多频率成分FFT谱分析的问题

[复制链接]
发表于 2011-4-28 15:18 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 czk108 于 2011-4-28 15:28 编辑

R=[7.0357 7.0566 7.0777 7.0988 7.1201 7.1415 7.1632 7.1850 7.2068 7.2290 7.2511 7.2735 7.2961 7.3188 7.3418 7.3647 7.3880 7.4114 7.4349 7.4586 7.4825 7.5066 7.5308 7.5552 7.5800 7.6047 7.6297 7.6548 7.6802 7.7058 7.7315 7.7575 7.7836 7.8099 7.8364 7.8632 7.8902 7.9174 7.9447 7.9724 8 8.0282 8.0565 8.0849 8.1137 8.1426 8.1718 8.2012 8.2308 8.2607 8.2909 8.3212 8.3518 8.3827 8.4139 8.4452 8.4769 8.5088 8.5410 8.5734 8.6061 8.6391 8.6724 8.7059 8.7399 8.7741 8.8085 8.8431 8.8782 8.9135 8.9492 8.9852 9.0215 9.0580 9.0949 9.1322 9.1698 9.2078 9.2460 9.2847 9.3237 ];%共81个值
f1=92e5.*R./81 ;%距离换算成频率
f0=23e9;c=3e8;
fs=92e9/5400;
deltf=1e6;
t=1:1024;
chapais=0.5*cos(2*pi*f1(1)*t/fs)+0.5*cos(2*pi*f1(2)*t/fs)+0.5*cos(2*pi*f1(3)*t/fs)+0.5*cos(2*pi*f1(4)*t/fs)+0.5*cos(2*pi*f1(5)*t/fs)+...
    0.5*cos(2*pi*f1(6)*t/fs)+0.5*cos(2*pi*f1(7)*t/fs)+0.5*cos(2*pi*f1(8)*t/fs)+0.5*cos(2*pi*f1(9)*t/fs)+0.5*cos(2*pi*f1(10)*t/fs)+...
    0.5*cos(2*pi*f1(11)*t/fs)+0.5*cos(2*pi*f1(12)*t/fs)+0.5*cos(2*pi*f1(13)*t/fs)+0.5*cos(2*pi*f1(14)*t/fs)+0.5*cos(2*pi*f1(15)*t/fs)+...
    0.5*cos(2*pi*f1(16)*t/fs)+0.5*cos(2*pi*f1(17)*t/fs)+0.5*cos(2*pi*f1(18)*t/fs)+0.5*cos(2*pi*f1(19)*t/fs)+0.5*cos(2*pi*f1(20)*t/fs)+...
    0.5*cos(2*pi*f1(21)*t/fs)+0.5*cos(2*pi*f1(22)*t/fs)+0.5*cos(2*pi*f1(23)*t/fs)+0.5*cos(2*pi*f1(24)*t/fs)+0.5*cos(2*pi*f1(25)*t/fs)+...
    0.5*cos(2*pi*f1(26)*t/fs)+0.5*cos(2*pi*f1(27)*t/fs)+0.5*cos(2*pi*f1(28)*t/fs)+0.5*cos(2*pi*f1(29)*t/fs)+0.5*cos(2*pi*f1(30)*t/fs)+...
    0.5*cos(2*pi*f1(31)*t/fs)+0.5*cos(2*pi*f1(32)*t/fs)+0.5*cos(2*pi*f1(33)*t/fs)+0.5*cos(2*pi*f1(34)*t/fs)+0.5*cos(2*pi*f1(35)*t/fs)+...
    0.5*cos(2*pi*f1(36)*t/fs)+0.5*cos(2*pi*f1(37)*t/fs)+0.5*cos(2*pi*f1(38)*t/fs)+0.5*cos(2*pi*f1(39)*t/fs)+0.5*cos(2*pi*f1(40)*t/fs)+...
    0.5*cos(2*pi*f1(41)*t/fs)+0.5*cos(2*pi*f1(42)*t/fs)+0.5*cos(2*pi*f1(43)*t/fs)+0.5*cos(2*pi*f1(44)*t/fs)+0.5*cos(2*pi*f1(45)*t/fs)+...
    0.5*cos(2*pi*f1(46)*t/fs)+0.5*cos(2*pi*f1(47)*t/fs)+0.5*cos(2*pi*f1(48)*t/fs)+0.5*cos(2*pi*f1(49)*t/fs)+0.5*cos(2*pi*f1(50)*t/fs)+...
    0.5*cos(2*pi*f1(51)*t/fs)+0.5*cos(2*pi*f1(52)*t/fs)+0.5*cos(2*pi*f1(53)*t/fs)+0.5*cos(2*pi*f1(54)*t/fs)+0.5*cos(2*pi*f1(55)*t/fs)+...
    0.5*cos(2*pi*f1(56)*t/fs)+0.5*cos(2*pi*f1(57)*t/fs)+0.5*cos(2*pi*f1(58)*t/fs)+0.5*cos(2*pi*f1(59)*t/fs)+0.5*cos(2*pi*f1(60)*t/fs)+...
    0.5*cos(2*pi*f1(61)*t/fs)+0.5*cos(2*pi*f1(62)*t/fs)+0.5*cos(2*pi*f1(63)*t/fs)+0.5*cos(2*pi*f1(64)*t/fs)+0.5*cos(2*pi*f1(65)*t/fs)+...
    0.5*cos(2*pi*f1(66)*t/fs)+0.5*cos(2*pi*f1(67)*t/fs)+0.5*cos(2*pi*f1(68)*t/fs)+0.5*cos(2*pi*f1(69)*t/fs)+0.5*cos(2*pi*f1(70)*t/fs)+...
    0.5*cos(2*pi*f1(71)*t/fs)+0.5*cos(2*pi*f1(72)*t/fs)+0.5*cos(2*pi*f1(73)*t/fs)+0.5*cos(2*pi*f1(74)*t/fs)+0.5*cos(2*pi*f1(75)*t/fs)+...
    0.5*cos(2*pi*f1(76)*t/fs)+0.5*cos(2*pi*f1(77)*t/fs)+0.5*cos(2*pi*f1(78)*t/fs)+0.5*cos(2*pi*f1(79)*t/fs)+0.5*cos(2*pi*f1(80)*t/fs)+...
    0.5*cos(2*pi*f1(81)*t/fs);%81个正弦信号叠加
figure(1)
plot(chapais,'k');
N=1024;
S=abs(fft(chapais,N));
% S=fftshift(S1);
f=(0:N-1)*fs/N;
figure(2)
plot(f(1:N/2),S(1:N/2),'k');
figure(3)
% stem(S(n1:n2),'.');
stem(f(1:N/2),S(1:N/2),'.k');
axis([0.6e6,1.2e6,0,2500]);title('局部放大FFT谱');
figure(4)
% stem(S(n1:n2),'.');
plot(f(1:N/2),S(1:N/2),'k');
axis([0.6e6,1.2e6,0,2500]);title('局部放大FFT谱');
disp('index')
index=find(S>=max(S(2:N-1)))
index11=(index(index<N/2))
if(S(index11+1)<S(index11-1))
    n1=index11-14
    n2=index11+11
else
    n1=index11-6
    n2=index11+19
end
f=(index11-1)*fs/N   %减1?
R=3e8*f/(2*1536e6)*(1536/(fs))

%czt
% n1=index11-4;
% n2=index11+2;
M=100;                           % czt细化倍数
A=exp(j*2*pi*n1/N);              % czt参数设置
W=exp(-j*2*pi*(n2-n1)/(M*N));
spec=czt(chapais,M,W,A);               % czt变换
a=abs(spec);                     
index1=((0:length(spec)-1)'*(n2-n1)/length(spec))+n1;
f1=(index1-1).*fs/N;
figure(5),plot(f1,a,'k');           %绘制czt细化后频谱
title('CZT细化');
grid on;
figure(6),stem(f1,a,'.k');           %绘制czt细化后频谱
title('CZT细化');
grid on;
% 寻找峰值
index=find(a>=max(a));
ag=a(index)
m=n1+(n2-n1)/M*(index-1);   %峰值对应谱线号
fff=(m-1)*fs/N
R=3e8*fff/(2*1536e6)*(1536/(fs))

理想中信号chapais的FFT谱应该是幅值相同、带宽与实际频率f1的宽度范围对应的理想谱,而实际运行得到的频谱确不一样,会是什么原因呢?望高手帮忙解答   还有帮忙看下程序中有没有问题   谢谢

回复
分享到:

使用道具 举报

您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

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

GMT+8, 2024-11-24 16:37 , Processed in 0.065891 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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