Plotting spectrogram for EEG data

Greetings!
I am done with the filtering and plotting the power spectrum for the EEG data. Now I want to plot the spectrogram for this data. I have tried using the 'spectrogram' and 'stft' function and played with the various input options but I do not get the plot the way I want it to be. Could someone please show me some light in this regard.
Thanks!
P.S. : I need to get it as shown in figure 1 (Reference: William E. DeCoteau et. al. www.pnas.orgcgidoi10.1073pnas.0700818104). Instead I get it as shown in the figure 2.

3 comentarios

Jakob B. Nielsen
Jakob B. Nielsen el 5 de Feb. de 2020
Can you show us what you do to get your figure, and your data? Otherwise, off the top of my mind, try using the surf function and add shading interp in there.
Thanks a lot for your reply! I get it as shown in figure 2. I have used the 'stft' function as follows and got the plot,
stft(data, fs);
Sudon Biswas
Sudon Biswas el 6 de Feb. de 2021
Could you plz provide me spectrogram and magnitude squared coherence (MSC) Matlab code for ECG signal? The code must be for single signal example: 1. For raw signal 2. Noisy Signal 3. For noise free signal

Iniciar sesión para comentar.

Respuestas (1)

Daniel M
Daniel M el 24 de Abr. de 2020

0 votos

You should plot the absolute value of your output from spectrogram or stft. Maybe even the log, or 10*log10 too (but I don't recall exactly, you'll have to look up the documentation). Basically, when you call those functions with outputs, try and make the plot match the one you get when you call the functions without outputs.
Your spectral and temporal resolution are very different from the first figure. That paper is doing a time-frequency analysis over ~ 4 seconds and 25 Hz. You are looking at ~150 ms and 500 Hz. You can look at this tutorial (with video) on how time window and frequency resolution trade-off with each other.

5 comentarios

Sudon Biswas
Sudon Biswas el 6 de Feb. de 2021
Could you plz provide me spectrogram and magnitude squared coherence (MSC) Matlab code for ECG signal? The code must be for single signal example: 1. For raw signal 2. Noisy Signal 3. For noise free signal
Walter Roberson
Walter Roberson el 6 de Feb. de 2021
Your wording sounds a lot like you have a homework assignment and you are hoping that someone will write the code for you instead of you writing the code yourself.
Sudon Biswas
Sudon Biswas el 6 de Feb. de 2021
Actually I am trying but can not understand the clearly thats why I am asking Because in matlab command there are two input signal.but I want to try for each signal MSC Sir
Sudon Biswas
Sudon Biswas el 6 de Feb. de 2021
@Walter Roberson
Walter Roberson
Walter Roberson el 7 de Feb. de 2021
Coherence is only defined between two signals, not one signal by itself. https://en.wikipedia.org/wiki/Coherence_(signal_processing)

Iniciar sesión para comentar.

Categorías

Más información sobre Measurements and Feature Extraction en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 5 de Feb. de 2020

Comentada:

el 7 de Feb. de 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by