########################################################################################
###python程序
import numpy as np
from scipy import stats
st = 0.01
data = np.sin(np.array([st*i for i in range(1001)]))
Xr = np.mean(np.sqrt(abs(data)))*np.mean(np.sqrt(abs(data)))
Xmean = np.mean(abs(data))
Xrms = np.sqrt(np.dot(data,data)/len(data))
Xp = max(max(data), -min(data))
########################################################################################
###python程序
fs = 1/st
N = len(data)
y = 2*abs(fft(data))/N
f = np.array([(i+1)*fs/N for i in range(N)])
FC = np.dot(f,y)/np.sum(y)
MSF = np.dot(np.multiply(f,f),y)/np.sum(y)
RMSF = np.sqrt(MSF)
VF = np.dot(np.multiply(f-FC,f-FC),y)/np.sum(y);
RVF = np.sqrt(VF)