function MNF = meanfreq(X_psd,Fs)

w=[0:length(X_psd)-1]*Fs/length(X_psd);
w= w(1:ceil(length(X_psd)/2));

X_psd= X_psd(1:ceil(length(X_psd)/2));

MNF= sum(w.*X_psd)/sum(X_psd);