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 Center および File ExchangeMultirate Signal Processing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by