How to edit y-axis scale in pop_spectopo function to log power spectral density 10*log10(uV^2/Hz)

9 次查看(过去 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)');

采纳的回答

Star Strider
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.
.

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by