I have a problem with my solution
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Time-Frequency Analysis en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!