MATLAB: 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

eeg plot

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)

Best Answer

Look at freq=(1:N/2)*fs/N ,its length is different from PS length