Created
October 16, 2016 13:41
-
-
Save jiqiujia/fdd86be507d0dab530efd31c3cddec47 to your computer and use it in GitHub Desktop.
generate the spectrogram of one dimensional signal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %%reference: http://www.mathworks.com/help/signal/ref/spectrogram.html | |
| dat = load('/media/dl/data1/kaggle_eeg_2016/train_1/1_1_1.mat'); | |
| dat = dat.dataStruct.data; | |
| dat = dat(:, 1); | |
| Nx = length(dat); %sample number | |
| nsc = floor(Nx/600); %number of signal sections | |
| nov = floor(nsc/2); %overlap between adajacent windows | |
| nff = max(256,2^nextpow2(nsc)); %number of samples to compute the FFT | |
| [S, F, T, P] = spectrogram(dat,hamming(nsc),nov,nff); | |
| figure; | |
| imshow((P)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment