php中文网 | cnphp.com

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 473|回复: 0

MATLAB实现预测性维护

[复制链接]

3138

主题

3148

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

UID
1
威望
0
积分
7946
贡献
0
注册时间
2021-4-14
最后登录
2024-11-21
在线时间
763 小时
QQ
发表于 2022-8-22 10:00:31 | 显示全部楼层 |阅读模式
[mw_shl_code=applescript,true]clear all;
Pumps_Frequency=xlsread('D:\matlab\PUMP_HZ');
Pumps_Current=xlsread('D:\matlab\PUMP_Current');
Inlet_Flow_Level=xlsread('D:\matlab\FLOW_LEVEL');
Combination=cat(2,Pumps_Frequency,Pumps_Current,Inlet_Flow_Level);
%---Data process
Combination(any(isnan(Combination)'),=[];
%---[m,n]=size(Combination);
k1 = find(((~Combination(:,20))|(~Combination(:,21))));
Combination(k1, = [];
k2 = find((~Combination(:,16)));
Combination(k2, = [];
k3 = find((~Combination(:,9))&(~Combination(:,10))&(~Combination(:,11))&(~Combination(:,12))&(~Combination(:,13))&(~Combination(:,14)));
Combination(k3, = [];
Ave_L=(Combination(:,20)+Combination(:,21))/2;
P1_current=Combination(:,9);
P2_current=Combination(:,10);
P3_current=Combination(:,11);
P4_current=Combination(:,12);
P5_current=Combination(:,13);
P6_current=Combination(:,14);
Flowrate=Combination(:,16);
Net_input=[P1_current P2_current P3_current P4_current P5_current P6_current Ave_L];
for i=1:10
r_4(i)=0.0;q_4(i)=0.0;
r_4(i)=Combination(find(Combination(:,5)>(39+i) & Combination(:,5)<(39.4+i),1),5);
q_4(i)=Combination(find(Combination(:,5)>(39+i) & Combination(:,5)<(39.4+i),1),12);
end
[xData_4, yData_4] = prepareCurveData( r_4, q_4 );
ft_4 = fittype( 'poly3' );
[fitresult_4, gof_4] = fit( xData_4, yData_4, ft_4 );
figure( 'Name', 'Current_Frequency' );
h4 = plot( fitresult_4,'y', xData_4, yData_4 );
hold on;
legend( h4, 'A vs. HZ', 'Current_Frequency', 'Location', 'NorthEast', 'Interpreter', 'none' );
xlabel( 'HZ', 'Interpreter', 'none' );
ylabel( 'A', 'Interpreter', 'none' );
grid on

for i=1:10
r_1(i)=0.0;q_1(i)=0.0;
r_1(i)=Combination(find(Combination(:,2)>(39+i) & Combination(:,2)<(39.4+i),1),2);
q_1(i)=Combination(find(Combination(:,2)>(39+i) & Combination(:,2)<(39.4+i),1),9);
end
[xData_1, yData_1] = prepareCurveData( r_1, q_1 );
ft_1 = fittype( 'poly3' );
[fitresult_1, gof_1] = fit( xData_1, yData_1, ft_1 );
%figure( 'Name', 'Current_Frequency' );
h1 = plot( fitresult_1,'c',xData_1, yData_1 );
hold on;

for i=1:10
r_3(i)=0.0;q_3(i)=0.0;
r_3(i)=Combination(find(Combination(:,4)>(39+i) & Combination(:,4)<(39.4+i),1),4);
q_3(i)=Combination(find(Combination(:,4)>(39+i) & Combination(:,4)<(39.4+i),1),11);
end
[xData_3, yData_3] = prepareCurveData( r_3, q_3 );
ft_3 = fittype( 'poly3' );
[fitresult_3, gof_3] = fit( xData_3, yData_3, ft_3 );
h3 = plot( fitresult_3,'g',xData_3, yData_3 );
hold on;

for i=1:10
r_2(i)=0.0;q_2(i)=0.0;
r_2(i)=Combination(find(Combination(:,3)>(39+i) & Combination(:,3)<(39.4+i),1),3);
q_2(i)=Combination(find(Combination(:,3)>(39+i) & Combination(:,3)<(39.4+i),1),10);
end
[xData_2, yData_2] = prepareCurveData( r_2, q_2 );
ft_2 = fittype( 'poly3' );
[fitresult_2, gof_2] = fit( xData_2, yData_2, ft_2 );
h2 = plot( fitresult_2,'b',xData_2, yData_2 );
hold on;

for i=1:10
r_5(i)=0.0;q_5(i)=0.0;
r_5(i)=Combination(find(Combination(:,6)>(39+i) & Combination(:,6)<(39.4+i),1),6);
q_5(i)=Combination(find(Combination(:,6)>(39+i) & Combination(:,6)<(39.4+i),1),13);
end
[xData_5, yData_5] = prepareCurveData( r_5, q_5 );
ft_5 = fittype( 'poly3' );
[fitresult_5, gof_5] = fit( xData_5, yData_5, ft_5 );
h5 = plot( fitresult_5,'k',xData_5, yData_5 );
hold on;

for i=1:9
r_6(i)=0.0;q_6(i)=0.0;
r_6(i)=Combination(find(Combination(:,7)>(40+i) & Combination(:,7)<(40.4+i),1),7);
q_6(i)=Combination(find(Combination(:,7)>(40+i) & Combination(:,7)<(40.4+i),1),14);
end
[xData_6, yData_6] = prepareCurveData( r_6, q_6 );
ft_6 = fittype( 'poly3' );
[fitresult_6, gof_6] = fit( xData_6, yData_6, ft_6 );
h6 = plot( fitresult_6, xData_6, yData_6 );
hold on;

[/mw_shl_code]

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|php中文网 | cnphp.com ( 赣ICP备2021002321号-2 )

GMT+8, 2024-11-22 02:02 , Processed in 1.197206 second(s), 42 queries , Gzip On.

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2020, Tencent Cloud.

申明:本站所有资源皆搜集自网络,相关版权归版权持有人所有,如有侵权,请电邮(fiorkn@foxmail.com)告之,本站会尽快删除。

快速回复 返回顶部 返回列表