How to edit y-axis scale in pop_spectopo function to log power spectral density 10*log10(uV^2/Hz)
10 ビュー (過去 30 日間)
古いコメントを表示
I am trying to plot the average power spectrum for a group of participants. MatLab automatically uses a numeric scale for the yaxis, this can be changed to 'log' in the figure editor page but I want the y-axis to use the following scale: log power spectral density 10*log10(uV^2/Hz).
I am plotting an average power spectrum for one channel for a group of subjects.
This is my current code:
dataDir_1 = '/Users/juliannemcleod/Documents/Data1';
ch = 20; % ch is the number of channel you need
i = 1; %% i is the subject number
ch = 20;
setFiles_1 = dir(fullfile(dataDir_1, '*.set'));
for i = 1:length(setFiles_1)
EEG1 = pop_loadset('filename', setFiles_1(i).name, 'filepath', setFiles_1(i).folder);
spectrum_1(i,:) = pop_spectopo(EEG1, 1, [], 'EEG' , 'percent', 100, 'freq', [0 100], 'freqrange', [0 100], 'electrodes', 'off', 'plot', 'off', 'plotchans', ch);
end
figure;
plot(mean(spectrum_1,1));
xlim([0 100]); % Assuming you want frequencies from 0-100 Hz
xlabel('Frequency (Hz)');
0 件のコメント
採用された回答
Star Strider
2023 年 9 月 27 日
This ‘10*log10(uV^2/Hz)’ is the same a dB/Hz. Thi is the same as the units of the ‘pxx’ outputs of the pwelch and periodogram functions. If your ‘pop_spectopo’ function uses one of those functions, no further conversion is necessary. Just set:
ylabel('PSD (dB\muV/Hz)')
or something similar.
.
2 件のコメント
Star Strider
2023 年 9 月 27 日
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Spectral Measurements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!