フィルターのクリア

spectrogram of a matrix with 32 channels in one graph with color

6 ビュー (過去 30 日間)
Fatemeh Yousef Zadeh
Fatemeh Yousef Zadeh 2022 年 7 月 6 日
編集済み: Prajakta Rathod 2023 年 4 月 4 日
Hi all,
I have matrix of EEG data with 32 channels.
I want to create a stacked spectrogram for all 32 channels in one graph to find the hot spots.
I like the x-axis to show the frequency, the y-axis all my channels stacked on one another.
I really appreciate your help.

採用された回答

Chunru
Chunru 2022 年 7 月 7 日
編集済み: Chunru 2022 年 7 月 8 日
% generate some data
fs = 500;
x = sin(2*pi*(0:1023)'*(1:32)/fs) + randn(1024, 32);
for i=1:size(x, 2)
[s,f,t] = spectrogram(x(:,i), 256,128,256, fs, 'psd');
if i==1
idx = find(f<=55); % get the freq range
nf = length(idx);
faxis = f(idx);
sall = zeros(nf, size(s,2), 32);
end
sall(:, :, i) = 20*log10(abs(s(idx, :)));
end
imagesc(faxis, [1:32], reshape(sall, nf, [])');
xlabel('f (Hz)');
ylabel('Ch')
  6 件のコメント
Chunru
Chunru 2023 年 4 月 4 日
[s,f,t] = spectrogram(x(:,i), 256,128,256, fs, 'psd'); return s as short-time-fouriour-transform. 20*log10(abs(s)) is spectrum density estimate (subject to a normalization factor of NFFT and sampling frequency).
if you want to get the ower spectral density or power spectrum direction, you cab use [s,f,t, ps] = spectrogram(x(:,i), 256,128,256, fs, 'psd'); Here ps is the one-sided (for real signal) modified periodogram (a power spectral density estimate).
To recap, the plot above show power spectrum in dB (subject to a constant factor)
doc spectrogram for more details.
Prajakta Rathod
Prajakta Rathod 2023 年 4 月 4 日
編集済み: Prajakta Rathod 2023 年 4 月 4 日
Sir, thank you very much for your reply.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEEG/MEG/ECoG についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by