How to edit y-axis scale in pop_spectopo function to log power spectral density 10*log10(uV^2/Hz)
조회 수: 13 (최근 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에서 Bartlett에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!