problem with my results

2 次查看(过去 30 天)
raj
raj 2012-2-2
编辑: Jon 2013-9-26
I am plotting a spectrogram using STFT algorithm generated by me everything works fine but my results are not what i expected please help me where I am wrong.
clear all
close all
clc
Fs = 2*max(100,300);
t = 0:1/Fs:1-1/Fs;
t1 = t(end);
x = chirp(t,300,t1,100,'linear');
w = rectwin(10)';
nw= length(w);
X = fft(x);
Total = [];
y = length(x) - nw;
for tau = 0: y
S = 0;
if tau == 0 %1st window
S = X(1:nw);
else %THE remaining windows generated from here
for k = 0:nw-1
for n = 0:nw-1
S= (exp(2*pi*1j*k/nw).*(X(tau : tau + nw-1) - x(tau)+...
x(nw+tau).*exp(-2*pi*1j*n/nw)));
end
end
end
W= S(1:end/2);
Total = [Total; W];
end
%plotting
T = 1:length(x)/2;
imagesc(T,1:Fs/2,20*log10(abs(Total).^2))
axis xy; axis tight; colormap(jet);
xlabel('Time in sec');
ylabel('Frequency (Hz)');
  9 个评论
Walter Roberson
Walter Roberson 2012-2-2
Looking at that page, they say that down-chirps exist, and it appears that k (rate of increase in frequency) could be negative.
raj
raj 2012-2-2
My problem is not with chirp signal consider any signal but I am not getting the spectrogram expected please try with a signal of ur own

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Time-Frequency Analysis 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by