|
本帖最后由 matlab的旋律 于 2019-3-11 06:36 编辑
通常振动信号为一时间序列,衡量振动信号的指标包括时域指标和频域指标,网上分享计算公式和源程序的比较少,本文给出了公式定义以及matlab/python源码。常见时域指标包括:
对应的Matlab程序如下:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%matlab程序
close all
clear
clc
st = 0.01;
data = sin(0:st:10);
Xr = mean(sqrt(abs(data)))*mean(sqrt(abs(data)));
Xmean = mean(abs(data));
Xrms = rms(data);
Xp=max(max(data), -min(data));
disp(['均方根值:',num2str(Xrms)]);
disp(['峰值指标:',num2str(max(max(data), -min(data)))]);
disp(['峰值因子:',num2str(Xp/Xrms)]);
disp(['峭度因子:',num2str(kurtosis(data))]);
disp(['峰度因子:',num2str(skewness(data))]);
disp(['方根幅度:',num2str(Xr)]);
disp(['裕度系数:',num2str(Xp/Xr)]);
disp(['绝对平均值:',num2str(Xmean)]);
disp(['脉冲因子:',num2str(Xp/mean(abs(data)))]);
disp(['波形指标:',num2str(Xrms/Xmean)]);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
########################################################################################
###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))
print('均方根值:',Xrms)
print('峰值指标:',Xp);
print('峰值因子:',Xp/Xrms)
print('峭度因子:',stats.kurtosis(data))
print('峰度因子:',stats.skew(data))
print('方根幅度:',Xr)
print('裕度系数:',Xp/Xr)
print('绝对平均值:',Xmean)
print('脉冲因子:',Xp/np.mean(abs(data)))
print('波形指标:',Xrms/Xmean)
print('方差为:',np.var(data))
print('标准差为:',np.std(data))
########################################################################################
对应的Matlab程序如下:
close all
clear
clc
st = 0.01;
data = sin(0:st:10);
fs = 1/st;
N = length(data);
y = 2*abs(fft(data))/N;
f = fs*[1:N]/N;
FC = sum(f.*y)/sum(y);
MSF = sum(f.^2.*y)/sum(y);
RMSF = sqrt(MSF);
VF = sum((f-FC).^2.*y)/sum(y);
RVF = sqrt(VF);
disp(['重心频率:',num2str(FC)]);
disp(['均方频率:',num2str(MSF)]);
disp(['均方根频率:',num2str(RMSF)]);
disp(['频率方差:',num2str(VF)]);
disp(['频率标准差:',num2str(RVF)]);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
########################################################################################
###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)
print('重心频率:',FC)
print('均方频率:',MSF)
print('均方根频率:',RMSF)
print('频率方差:',VF)
print('频率标准差:',RVF)
########################################################################################
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
|