specifying frequencies in pwelch not working

9 visualizaciones (últimos 30 días)
Karen Konkoly
Karen Konkoly el 28 de Jul. de 2022
Comentada: Chunru el 30 de Jul. de 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?

Respuestas (1)

Chunru
Chunru el 29 de Jul. de 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 comentarios
Karen Konkoly
Karen Konkoly el 29 de Jul. de 2022
I just tried updating my matlab but that didn't work...
Chunru
Chunru el 30 de Jul. de 2022
Could you be more specific?

Iniciar sesión para comentar.

Categorías

Más información sobre EEG/MEG/ECoG en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by