フィルターのクリア

contourf lower edge effects, how to fix and how does contourf work

1 回表示 (過去 30 日間)
Joanne Hall
Joanne Hall 2022 年 10 月 12 日
コメント済み: Star Strider 2022 年 10 月 15 日
Dear Matlab,
Using CONTOURF() to plot phase-amplitude coupling with an EEG signal, there appears what I call 'an edge effect' at the bottom of the plot (whereby the largest activity is always colored at the bottom of the plot) SEE ATTACHED IMAGE. I would like to capture the entire range of the 'hottest color blods' so I tried changing the y-axis range. BUT If I change the y-axis to range, no metter what - The 'hottest' colors always end up at the bottom of the plot. So I don't know how contourf() works then. Can you please help me? Thanks very much in advance!
Attached is sample data and pasted code below...
The variable that I change below to adjust/change the y-axis range is:
power_frex = linspace(15,60,45);
(and the resulting plot always has a blob at the bottom)
ATTACHED ARE EXAMPLE PLOTS FROM CHANGING THE Y-AXIS RANGE VIA THE 'power_frex' variable.
%% signal parameters
load signal
srate = 250;
lowerfreq = 6;
upperfreq = 40; % Hz
%%% Compute PAC
phase_frex = linspace(1,10,15);
power_frex = linspace(15,60,45);
pac = zeros(length(power_frex),length(phase_frex));
for lowfi=1:length(phase_frex)
% get phase time series
phasets = exp(1i*angle(hilbert(filterFGx(signal,srate,phase_frex(lowfi),1))));
% loop over amplitude frequencies
for hifi=1:length(power_frex)
% get power time series
powts = abs(hilbert(filterFGx(signal,srate,power_frex(hifi),lowerfreq*2))).^2;
% PAC
pac(hifi,lowfi) = abs(mean( powts.*phasets ));
end
end
%%% visualize
figure(4), clf
contourf(phase_frex,power_frex,pac,40,'linecolor','none')
xlabel('Phase freq. (Hz)')
ylabel('Ampl. freq. (Hz)')
Joanne

採用された回答

Star Strider
Star Strider 2022 年 10 月 12 日
We’re missing the filter function you’re using, so not able to run your code. However the pspectrum 'spectrogram' plot demonstrates that the pwer is concentrated at the lower frequencies (as expected). I’m not certain how you’re limiting the plots you’re creating, however setting the appropriate axis limits rather than restricting the values plotted may produce the result you want.
Try something like this —
LD = load(websave('TESTsignal','https://www.mathworks.com/matlabcentral/answers/uploaded_files/1153968/TESTsignal.mat'));
signal = LD.signal;
srate = 250;
lowerfreq = 6;
upperfreq = 40; % Hz
%%% Compute PAC
phase_frex = linspace(1,10,15);
power_frex = linspace(15,60,45);
% figure
[p,f,t] = pspectrum(signal, srate, 'spectrogram');
figure
surfc(t,f,10*log10(p), 'EdgeColor','none')
colormap(turbo)
hcb = colorbar;
hcb.Label.String = 'Power (dB)';
zlim([-50 max(zlim)])
xlabel('Time')
ylabel('Frequency')
zlabel('Power (dB)')
title('Frequency: 0 - 125 Hz')
figure
surfc(t,f,10*log10(p), 'EdgeColor','none')
colormap(turbo)
hcb = colorbar;
hcb.Label.String = 'Power (dB)';
ylim([50 max(ylim)])
zlim([-50 max(zlim)])
xlabel('Time')
ylabel('Frequency')
zlabel('Power (dB)')
title('Frequency: 50 - 125 Hz')
.
  4 件のコメント
Joanne Hall
Joanne Hall 2022 年 10 月 15 日
Thanks so much Star!!!
Star Strider
Star Strider 2022 年 10 月 15 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by