i need to plot the EEG in matlab.. i have downloaded the data base which is in .txt format. bt i am unable to plot it.. plz help

조회 수: 5 (최근 30일)
x=load('F001.txt');
y=fft(x)
PS=abs(y).^2;
N=length(x);
fs=1000;
freq=(1:N/2)*fs/N;
plot(freq,PS)
this is not working,... an error is reported
Error using plot Vectors must be the same lengths.
Error in PLOT (line 7) plot(freq,PS)

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 11월 2일
Look at freq=(1:N/2)*fs/N ,its length is different from PS length
  댓글 수: 5
Azzi Abdelmalek
Azzi Abdelmalek 2013년 11월 2일
편집: Azzi Abdelmalek 2013년 11월 2일
x=load('F001.txt');
y=fft(x)
PS=abs(y).^2;
N=length(x);
fs=1000;
freq=(0:N-1)*fs/N;
plot(freq,PS)
If you want a symetric plot for frequencies: [-freq,freq]
freq=(0:ceil(N/2)-1)*fs/N;
PS=PS(1:numel(freq));
plot([-freq freq],[fliplr(PS) PS])

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 EEG/MEG/ECoG에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by