I have a problem with my solution
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Time-Frequency Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!