specifying frequencies in pwelch not working

5 Ansichten (letzte 30 Tage)
Karen Konkoly
Karen Konkoly am 28 Jul. 2022
Kommentiert: Chunru am 30 Jul. 2022
Last year, I could input the following into pwelch and it would give me a nice output with the mean alpha power in that piece of data
data = EEG.data; %assume this is 1 row of my EEG data of interest
analysisWinSize = 1000; % in data points
Overlap = 500; % in data points. overlap of windows.
FreqOfInterest = 8 : .5 : 12.5;
sr = 1000; %Sampling rate in Hz
freqOverTime = pwelch(data, analysisWinSize, Overlap, FreqOfInterest, sr);
windows.AlphaPowerF3(i) = mean(freqOverTime,'all');
I But now when I try to run it, it first gives the error,
"Error using pwelch (line 503)
pwelch: arg 3 (overlap) must be real from 0 to 0.950000"
If I change the overlap to "[]" (the default is 50% anyways), then I get the error:
Error using pwelch (line 511)
pwelch: arg 4 (Nfft) must be integer >=0
And I can't figure out how to change it. I don't want it to be an integer or Nfft, it is supposed to be an array that specifies the frequencies I want to do the analysis on. The documentation made it seem like the function would interpret the input differently depending on whether it was an integer or array, but I can't figure out a way around this error. Did the pwelch function change? Can anyone help?

Antworten (1)

Chunru
Chunru am 29 Jul. 2022
No problem for on-line matlab.
data = randn(20000,1); %assume this is 1 row of my EEG data of interest
analysisWinSize = 1000; % in data points
Overlap = 500; % in data points. overlap of windows.
FreqOfInterest = 8 : .5 : 12.5;
sr = 1000; %Sampling rate in Hz
freqOverTime = pwelch(data, analysisWinSize, Overlap, FreqOfInterest, sr);
plot(FreqOfInterest, freqOverTime)
%windows.AlphaPowerF3(i) = mean(freqOverTime,'all');
  2 Kommentare
Karen Konkoly
Karen Konkoly am 29 Jul. 2022
I just tried updating my matlab but that didn't work...
Chunru
Chunru am 30 Jul. 2022
Could you be more specific?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu EEG/MEG/ECoG finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by