标题:大家帮调下程序!
取消只看楼主
wrx52574800
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2007-5-9
 问题点数:0 回复次数:0 
大家帮调下程序!
看看怎么提高分辨率啊,现在程序误差很大!谢谢!
clear
clc
figure(1)
T=0.02;
fs=120/0.02;
Ts=1/fs;
N=T/Ts;
n=0:N-1;
t=(0:N-1)*Ts;
f0=400;
x=cos(5/7*pi*f0*t);
% [x,fs]=wavread('a2.wav');
% t=(0:length(x)-1)/fs;
% T=(length(x)-1)/fs;
% Ts=1/fs;
% N=T/Ts;
subplot(221)
plot(t*Ts,real(x))
X=fft(x);
X=fftshift(X);
% m=0:N-1;
% f=(m-N/2)*fs/N;
subplot(222)
% plot(t,abs(X))
plot((t-N/2)*fs/N,abs(X))
Nw=20;
L=Nw/2;
Tn=(N-Nw)/L+1;
nfft=32;
TF=zeros(Tn,nfft);
for i=1:Tn
xw=x((i-1)*10+1:i*10+10);
% xw=x(((i-1)*10+1)/fs:(i*10+10)/fs);
temp=fft(xw,nfft);
temp=fftshift(temp);
TF(i,:)=temp;
end
subplot(223)
fnew=((1:nfft)-nfft/2)*fs/nfft;
tnew=(1:Tn)*L*Ts;
[F,T]=meshgrid(fnew,tnew);
mesh(F,T,abs(TF))
subplot(224)
contour(T,F,abs(TF))
搜索更多相关主题的帖子: figure 分辨率 
2007-05-27 20:10



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-142819-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.925368 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved