File:STFT colored spectrogram 1000ms.png

From testwiki
Jump to navigation Jump to search
STFT_colored_spectrogram_1000ms.png (560 × 420 pixels, file size: 7 KB, MIME type: image/png)

This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

Summary

Description

This picture is one of the four spectrograms I have created of the following signal:

sampled at 400 Hz. I have created this picture and all the other three spectrograms with the following Matlab code, that is based on my
stft
script that you can find at User:Alejo2083/Stft script:
clear all;

%sampling frequency
fc=400;
%duration of the signal
T=20;
%zero padding factor
my_zero=10;

%generate the signal
t=linspace(0,T,fc*T);
x=zeros(1,length(t));
%thresholds
th1=0.25*T*fc;
th2=0.5*T*fc;
th3=0.75*T*fc;
th4=T*fc;
x(1:th1)=cos(2*pi*10*t(1:th1));
x((th1+1):th2)=cos(2*pi*25*t((th1+1):th2));
x((th2+1):th3)=cos(2*pi*50*t((th2+1):th3));
x((th3+1):th4)=cos(2*pi*100*t((th3+1):th4));

%calculate and show the spectrograms
[spectrogram, axisf, axist]=stft(x,10,1,fc,'blackman',my_zero);
spectrogram=spectrogram/max(spectrogram(:));
figure,imagesc(axist,axisf,spectrogram),
title('Spectrogram with T = 25 ms'),
ylabel('frequency [Hz]'),
xlabel('time [s]'), 
colorbar;

[spectrogram, axisf, axist]=stft(x,50,1,fc,'blackman',my_zero);
spectrogram=spectrogram/max(spectrogram(:));
figure,imagesc(axist,axisf,spectrogram),
title('Spectrogram with T = 125 ms'),
ylabel('frequency [Hz]'),
xlabel('time [s]'), 
colorbar;

[spectrogram, axisf, axist]=stft(x,150,1,fc,'blackman',my_zero);
spectrogram=spectrogram/max(spectrogram(:));
figure,imagesc(axist,axisf,spectrogram),
title('Spectrogram with T = 375 ms'),
ylabel('frequency [Hz]'),
xlabel('time [s]'), 
colorbar;

[spectrogram, axisf, axist]=stft(x,400,1,fc,'blackman',my_zero);
spectrogram=spectrogram/max(spectrogram(:));
figure,imagesc(axist,axisf,spectrogram),
title('Spectrogram with T = 1000 ms'),
ylabel('frequency [Hz]'),
xlabel('time [s]'), 
colorbar;
Feel free to improve the code, to speed it up or just make it clearer.
Date
Source Own work
Author Alessio Damato
Other versions
The four spectrograms
  • 25 ms window
    25 ms window
  • 125 ms window
    125 ms window
  • 375 ms window
    375 ms window
  • 1000 ms window
    1000 ms window
  • PNG development
    InfoField
     This diagram was created with MATLAB.

    Licensing

    Alessio Damato, the copyright holder of this work, hereby publishes it under the following licenses:
    GNU head Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.
    w:en:Creative Commons
    attribution share alike
    This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported, 2.5 Generic, 2.0 Generic and 1.0 Generic license.
    Attribution:
    You are free:
    • to share – to copy, distribute and transmit the work
    • to remix – to adapt the work
    Under the following conditions:
    • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
    • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
    You may select the license of your choice.

    Captions

    Add a one-line explanation of what this file represents

    Items portrayed in this file

    depicts

    September 2007

    File history

    Click on a date/time to view the file as it appeared at that time.

    Date/TimeThumbnailDimensionsUserComment
    current09:13, 18 September 2007Thumbnail for version as of 09:13, 18 September 2007560 × 420 (7 KB)wikimediacommons>Alejo2083{{Information |Description=working... |Source=self-made |Date=September 2007 |Author= Alessio Damato |other_versions= }} Category:Short-time Fourier transform Category:Spectrogram

    The following page uses this file: