Compute the average of pwelch

Hi all
I have eeg signal with 129 samples,
I computed each signal, now I need to take the average of all 129 samples and plot that average. How can I do that?
Please help me.
I reeally appreciate that
clc;
close all;
clear;
load('eeg_Fs250Hz.mat');
[row columm] = size(eeg);
for i = 1:columm
[ppx{i}, f{i}] = pwelch(eeg(:,i),200,100,200,Fs);
figure(1);
plot(ppx{i});
hold on
end

Risposte (1)

Tala
Tala il 6 Apr 2022
not sure what the avarage of pwelch means! maybe avarage energy of your signal? there are better ways to do so...anyways...you could just this after your hold on command.
plot(mean(ppx{i}));
I would add f{i} as well in my plots. meaning plot(f{i}, ppx{i}) to see the frequencies on your plot

6 Commenti

That gave out just one value
Tala
Tala il 6 Apr 2022
The mean of an array is one value! Isn’t that what you wanted?
I am guessing you wanna use the mean like this. Subtracting the mean from the array
[ppx{i}, f{i}] = pwelch(eeg(:,i)-mean(eeg(:,i)),200,100,200,Fs);
sorry for not clear of the question,
I mean there are 129 ppx, I want the average of each element of 129 ppx, and plot the average
Tala
Tala il 6 Apr 2022
Modificato: Tala il 6 Apr 2022
use this after the loop
plot(mean(cell2mat(ppx)),':o')
I got it. Appreciate you a lot
Tala
Tala il 6 Apr 2022
Modificato: Tala il 6 Apr 2022
my pleasure

Accedi per commentare.

Prodotti

Release

R2021b

Richiesto:

il 6 Apr 2022

Modificato:

il 6 Apr 2022

Community Treasure Hunt

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

Start Hunting!

Translated by