How we can calculate Power spectrum of EEG signal?

28 visualizzazioni (ultimi 30 giorni)
Dear all . I want to calculate power spectrum of single channel eeg . I have coded following but it gives error
??? Subscript indices must either be real positive integers or logicals.
Error in ==> modemotion at 17
plot(ff,pp(0:63)); ylabel('power spectrum
density');xlabel('frequency');title('signal power spectrum');
Please give me how i can short out this.
%%%%%Program to calculate the power spectrum of EEG signal%%%%
clear all;
clc;
data=xlsread('C:\Users\SID\Desktop\emotion regulation post2\emotion\shim1.xlsx');
figure(1); xlabel('sample'); ylabel('magnitude'); plot(data);
legend('14 channel plot of subject1 BASELINE');
data= data';
value1=data(1,:);
chan1= value1-mean(value1);
fs=128;d=1/fs;
t=[0:length(chan1)-1]*d;
figure(2);
plot(chan1);title('original signal');
fs=fft(chan1,128);
pp=fs.*conj(fs)/128;
ff=(0:63)/128/d;
figure(3);
plot(ff,pp(0:63)); ylabel('power spectrum density');xlabel('frequency');title('signal power spectrum');
  2 Commenti
Star Strider
Star Strider il 6 Set 2012
%%%%%Program to calculate the power spectrum of EEG signal%%%%
clear all;
clc;
data=xlsread('C:\Users\SID\Desktop\emotion regulation post2\emotion\shim1.xlsx');
figure(1);
xlabel('sample');
ylabel('magnitude');
plot(data);
legend('14 channel plot of subject1 BASELINE');
data= data';
value1=data(1,:);
chan1= value1-mean(value1);
fs=128;
d=1/fs;
t=[0:length(chan1)-1]*d;
figure(2);
plot(chan1);
title('original signal');
fs=fft(chan1,128);
pp=fs.*conj(fs)/128;
ff=(0:63)/128/d;
figure(3);
plot(ff,pp(0:63));
ylabel('power spectrum density');
xlabel('frequency');
title('signal power spectrum');

Accedi per commentare.

Risposte (2)

Krishnapriya V B
Krishnapriya V B il 23 Set 2019
%%%%%Program to calculate the power spectrum of EEG signal%%%%
clear all;
clc;
data=xlsread('C:\Users\SID\Desktop\emotion regulation post2\emotion\shim1.xlsx');
figure(1); xlabel('sample'); ylabel('magnitude'); plot(data);
legend('14 channel plot of subject1 BASELINE');
data= data';
value1=data(1,:);
chan1= value1-mean(value1);
fs=128;d=1/fs;
t=[0:length(chan1)-1]*d;
figure(2);
plot(chan1);title('original signal');
fs=fft(chan1,128);
pp=fs.*conj(fs)/128;
ff=(0:63)/128/d;
figure(3);
plot(ff,pp(0:63)); ylabel('power spectrum density');xlabel('frequency');title('signal power spectrum');
  2 Commenti
Ashish Tiwari
Ashish Tiwari il 17 Dic 2019
plot(ff,pp( :,1:64)); ylabel('power spectrum density');xlabel('frequency');title('signal power spectrum');
do the minor change in your code and you will get your result just look at the last line and change that to this--->>"plot(ff,pp( : ,1:64)); .indexing was not done properly in your mentioned code

Accedi per commentare.


Ashish Tiwari
Ashish Tiwari il 28 Dic 2019
plot(ff,pp( :,1:64)); ylabel('power spectrum density');xlabel('frequency');title('signal power spectrum');
do the minor change in your code and you will get your result just look at the last line and change that to this--->>"plot(ff,pp( : ,1:64)); .indexing was not done properly in your mentioned code

Categorie

Scopri di più su EEG/MEG/ECoG in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by