-
大小: 5KB文件類型: .m金幣: 1下載: 3 次發(fā)布日期: 2021-08-11
- 語言: Matlab
- 標簽: 階次分析??matlab??變轉(zhuǎn)速??故障診斷??
資源簡介
matlab實現(xiàn)的階次分析算法,用于變轉(zhuǎn)速機械故障特征提取,可運行,包含尋找脈沖時刻,等角度時刻,數(shù)字跟蹤濾波,樣條差值等步驟
代碼片段和文件信息
%~~~~~~~~~~~~~導(dǎo)入數(shù)據(jù)~~~~~~~~~~~~~%
clc
clear
Fs=71680;
N=Fs*5;
t=(0:N-1)/Fs;
Adc?=?1;?%直流分量幅度
%?S=sin(2*pi*t.^2-?pi/6)+sin(4*pi*t.^2-?pi/6)+sin(8*pi*t.^2-?pi/6)
%?S2=Adc+?sin(2*pi*?t.^2-?pi/6);%參考軸的轉(zhuǎn)速為n(t)=60t?r/min
S=sin(2*pi*t.^2)+sin(4*pi*t.^2)+sin(8*pi*t.^2);
S2=Adc+?sin(2*pi*?t.^2);
array_time_amp=S;????%導(dǎo)入時域振動信號
pluse=S2;?????????????%導(dǎo)入脈沖信號
figure(1);
%?subplot(211)plot(tarray_time_amp)title(‘time?dominant振動信號時域圖‘)xlabel(‘時間time‘)ylabel(‘幅值amplitude‘);
subplot(211)plot(tarray_time_amp)title(‘變轉(zhuǎn)速數(shù)據(jù)‘)xlabel(‘時間time‘)ylabel(‘幅值amplitude‘);
grid?on;
%?subplot(212)plot(tpluse)title(‘keyphasor鍵相脈沖仿真信號時域圖‘)xlabel(‘時間time‘)ylabel(‘幅值amplitude‘);
subplot(212)plot(tpluse)title(‘轉(zhuǎn)速脈沖‘)xlabel(‘時間time‘)ylabel(‘幅值amplitude‘);
grid?on;
%?%~~~~~~~~~~~~~~~計算脈沖發(fā)生時刻~~~~~~~~~~~~~~~%
%?Num_pluse1=1;
Num_pluse1=[];
Threshold=1.5;%設(shè)定脈沖閾值
for?temp2=1:length(pluse)-1;%設(shè)temp2為步長為1的[12.....n-1]n-1維數(shù)組;即將所有的采樣點編號;length函數(shù)功能是返回pluse的數(shù)組維數(shù);for循環(huán)體循環(huán)n-1次,再結(jié)束。
%?????for?temp2=1:length(pluse)-1;
????if(pluse(temp2)<1.5&&pluse(temp2+1)>=1.5)
?????????????Num_pluse1=[?Num_pluse1temp2+1];%Num_pluse1=[121967.....temp(2+1)]
????end
end
?Num_pluse1=Num_pluse1(1:length(Num_pluse1));
if?length(Num_pluse1)<2returnend;%如果脈沖信號就一個數(shù)則跳出計算脈沖發(fā)生時刻的函數(shù)
?t_pluse=(Num_pluse1-1)/Fs;%
%?
%?
%?
%?
%~~~~~~~~~~~~~~~等角度時間計算~~~~~~~~~~~~~~~~%
delt_thet=pi/24;
t_angle=[];
for?temp3=3:length(t_pluse);
b=inv([1t_pluse(temp3-2)t_pluse(temp3-2)^2;1t_pluse(temp3-1)t_pluse(temp3-1)^2;1t_pluse(temp3)t_pluse(temp3)^2])*[02*pi4*pi]‘;
????if?temp3==3;%(如果數(shù)temp3等于3則執(zhí)行第一個循環(huán),如果temp3不等于3則執(zhí)行第二個循環(huán),即在脈沖時刻[tt0tt3]執(zhí)行第一個循環(huán),等角度時刻記到[t1,t72])
???????k=0;
???????????while?k<1.5*2*pi/delt_thet;%0 ??????????????????tt=(sqrt(4*b(3)*(k*delt_thet-b(1))+b(2)^2)-b(2))/(2*(b(3)+eps));
??????????????????t_angle=[t_anglett];
??????????????????k=k+1;
????????????end
????else
????????k=pi/delt_thet;%k=24(如果temp3不等于3則執(zhí)行第二個循環(huán),即在脈沖時刻[tt1tt4].......[tt13tt16]執(zhí)行第二個循環(huán),等角度時刻記到[t72,t120],[t120t168]........[t648t696]))
????????????while?k>=pi/delt_thet?&&?k<1.5*2*pi/delt_thet;%?24 ????????????????tt=(sqrt(4*b(3)*(k*delt_thet-b(1))+b(2)^2)-b(2))/(2*(b(3)+eps));
????????????????t_angle=[t_anglett];
????????????????k=k+1;
????????????end
????end
end
ar
評論
共有 條評論