magic0elf 发表于 2011-5-26 22:49

【求助】关于STFT 和WVD的仿真

这是我在网上下的两个程序,运行后貌似少了信号源还是 什么 ?求高手看下,求指导。
STFT部分:三个怎么设
function = STFT(D,M,fm);

% y: input signal
% D: the data matrix: D(:,1)=t; D(:,2)=y;
% M: the lenght of the FT window


% The Frequency range for the signal
% SP: the spectogram (short time fourier transform) of D

%fm % the maximum freq

t=D(:,1);y=D(:,2);
N=length(y);

W=hanning(M);
ye=zeros(N+M,1);
ye(M/2+1:M/2+N)=y;
%yea=hilbert(ye);
dt=t(2)-t(1);% time resolution
fs=1/dt; % the sampling frequency

df=fs/M; %frequency resolution
L=round(fm/df); % the index of the max freq.
f=*df;

i=1;
while i<=N
   
   s=ye(i:i+M-1).*W;
   sa=hilbert(s);
   
   S=fft(sa);
   B(:,i)=S(1:L);
   i=i+1;% increase by one (next sample)
end

SP = (1/N)*abs(B.*B);
SP = SP/max(max(SP)); % normalize it
T= t;
F= f;



% mesh(T,F,SP)
% contour(T,F,SP)



还有一个是function =Wigner(D,fm)



谢谢

页: [1]
查看完整版本: 【求助】关于STFT 和WVD的仿真