I have a problem with my solution

1 次查看(过去 30 天)
raj
raj 2012-1-16
i am trying to implement STFT manually but I am not getting the correct solution in my code i am using a linear chirp but the problem is I get a wrong display ,I think the main problem will be because of the zero padding,I cannot implement zero padding please help me with that
clear all
close all
clc
f11 = 0; f12 = 100; % 350 - 500 Hz
fs = 2*max(0,100);
t = 0:0.001:1;
t1 = t(end);
x = chirp(t,f11,t1,f12,'linear');
w1 = 256;% window size
overlap = 255;
nx = length(x);% size of signal
w = hamming(w1)';% hamming window
nw = length(w);
step = nw - overlap;
W_total1 = [];%nullmatrix
offset = (1 : step : length(x)-nw) ;
T = 0:nx/fs;
%FOR LOOP TO GENERATE WINDOWED-OVERLAP AND FFT
for i=1:length(offset)
S(1:nw, i) = x(offset(i):offset(i)+nw-1) .* w;
W = fft(S(1:nw,i));
W = W(1:end/2);
W_total1 = [W_total1; W.'];
end
figure;
imagesc(T,1:fs/2,20*log10(abs(W_total1')))
axis xy; axis tight; colormap(jet);
xlabel('Time in sec');
ylabel('Frequency (Hz)');
colorbar

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multirate Signal Processing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by