Skip to content

Instantly share code, notes, and snippets.

@randmized
Last active February 1, 2018 14:10
Show Gist options
  • Save randmized/b0e09207e5ec509930022e8b8c730938 to your computer and use it in GitHub Desktop.
Save randmized/b0e09207e5ec509930022e8b8c730938 to your computer and use it in GitHub Desktop.
% Matlab Task 11 SMB2 31.1.18
% Task1Floating Window
clear;
load e23;
f0 = 250;
signal = e23;
t = 1/f0:1/f0:length(signal)/f0;
winsize = 24;
stft_coef = zeros(winsize/2+1, length(e23));
stft_result = zeros(length(e23), 1);
curr_signal = zeros(winsize/2+1, 1);
% startpunkt:schrittweite:endpunkt
for i=winsize/2:1:length(signal)-(winsize/2) %fenster
curr_signal = signal(i-winsize/2+1:i+winsize/2);
hamm_win = hamming(winsize);
curr_signal = curr_signal.* hamm_win;
%plot(hamm_win);
stft_coef = abs(fft(curr_signal));
stft_result(i-winsize/2+1:i+winsize/2) = stft_coef;
end
%plot(stft_result);
figure(1); clf;
imagesc(stft_result); colorbar;
title('STFT with win size 24');
figure(2); clf;
plot(t, signal);
title('e23.signal');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment