Function: exampleDLAR
2017-01-16 by:CAE仿真在线 来源:互联网
Function: exampleDLAR
% 程序版权归原作者所有。本人只是对源代码略作注释。目的是供自己今后使用少花时间。
% 该程序由原作者免费共享提供,不作商业用途的前提下,本人才得以拿出来供同行
% 及对matlab编程有兴趣的朋友分享、共同学习。
% AUTHORS:
% Eloi Figueiredo
%
% LA-CC-10-032
% Copyright (c) 2010, Los Alamos National Security, LLC
% All rights reserved.
% *******
%% Load Raw Data
%%
% Load data set:
load('data3SS.mat'); %导入数据文件
% 原数据格式为8192个样本点,5个通道,第1通道为激励,第2至5通道为响应;
% 数据第3维为测量次数,共170次,
data=dataset(:,2:5,:); %也就是说本程序使用的数据为全部170次测量的第2至5通道响应数据
% 以下代码为将第1次测量的响应数据4个通道画在图中。效果如下Figure 1
% Plot time histories from the baseline condition (Channel 2-5):
figure
for i=1:4;
subplot(2,2,i)
plot(data(:,i,1),'k')
title(['Channel ',num2str(i+1)])
set(gca,'YTick',-2:2,'Xlim',[1 8192],'Ylim',[-2.5 2.5])
if i==3 || i==4, xlabel('Observations'); end
if i==1 || i==3, ylabel('Acceleration (g)'); end
end
%确定AR模型阶数为15,这里选择了确定的数,实际在处理未知数据时需要进行试算确定
% AR model order:
arOrder=15;
%% 估计AR模型参数,就是AR系数,下面程序将计算出170次测量数据的AR系数
% 4个通道,170次,每个响应的AR系数有15个,最后形成的矩阵为170*60
% Estimation of the AR Parameters:
[arParameters]=arModel_shm(data,arOrder);
[n m]=size(arParameters); % n = 170, m = 60;
% 画出AR系数图,并将未损用黑色表示,损伤用红色表示,如Figure 2
% Plot test data:
figure;
plot(1:m,arParameters(1:90,:)','k',1:m,arParameters(90:170,:)','r')
title(['Concatenated AR(',num2str(arOrder),') Parameters for all Instances'])
legend('Undamaged','Damaged')
xlabel('AR Parameters')
ylabel('Amplitude')
w=8;
set(gca,'Xlim',[1 m])
M(1,1:9)='Undamaged'; M(2,1:7)='Damaged';
legend([line('color','k');line('color','r')],M);
h(1)=line([m/4;m/4],[-w w],'color','k','lineStyle','-.');
h(2)=line([m/4*2;m/4*2],[-w w],'color','k','lineStyle','-.');
h(3)=line([m/4*3;m/4*3],[-w w],'color','k','lineStyle','-.');
text(4,-7,'Channel 2','Color','k','EdgeColor','k','BackgroundColor','w')
text(18,-7,'Channel 3','Color','k','EdgeColor','k','BackgroundColor','w')
text(33,-7,'Channel 4','Color','k','EdgeColor','k','BackgroundColor','w')
text(48,-7,'Channel 5','Color','k','EdgeColor','k','BackgroundColor','w')
% 以下特征提取方法与诊断过程参考文献[1]
% 检测方法原理如下
%
% 1. 训练样本取自结构健康状态的特征数据,计算其均值 与协方差矩阵
% 2. 测试样本取自结构任意状态的特征数据,计算其到训练样本的Mahalanobis平方距离
%
%% Data Normalization for Novelty Detection
% The Mahalanobis-based machine learning algorithm is used to normalize the
% features and reduce each feature vector to a score.
DI=zeros(17,4);
scoreData=zeros(17,arOrder);
cnt=1;
for i=1:4;
% 取前9个健康工况第1至9次测量的AR系数作为训练样本,每个工况的第10次作为测试样本
for j=1:9;
learnData(j*9-8:j*9,:)=arParameters(j*10-9:j*10-1,cnt:cnt+arOrder-1);
end
scoreData(1:17,:)=arParameters(10*(1:17),cnt:cnt+arOrder-1);
% 9个工况的前9次测量的样本进行训练,获得模型model
[model]=learnMahalanobis_shm(learnData);
% 用model计算17个工况第10次测量的测试样本,
DI(:,i)=scoreMahalanobis_shm(scoreData,model);
cnt=cnt+arOrder;
end
%取指标的相反数
DI=-DI;
% 作图,如Figure 3
%% Damage Location
%%
% Plot DIs from Channel 2-5:
figure
for i=1:4;
subplot(2,2,i)
bar(1:9,DI(1:9,i),'k'); hold on; bar(10:17,DI(10:17,i),'r')
title(['Channel ',num2str(i+1)])
set(gca,'Xlim',[0 length(DI)+1],'XTick',1:length(DI))
grid on
if i==3 || i==4, xlabel('State Condition'); end
if i==1 || i==3, ylabel('DI'); end
end
Figure1
Figure2
Figure3
%%
% The figure above shows that the extracted features from Channels 2-3 are
% lesser sensitive than from Channels 4 and 5 to discriminate the undamaged
% (1-9) and damaged (10-17) state conditions. This is an indication that
% the source of damage is located near to Channels 4 and 5.
%%
% See also:
%
% <exampleDLARX.html Damage Location using ARX Parameters from an Array of
% Sensors>
参考文献
[1] Worden, K., Manson, G., Fieller, N. R. J. Damage detection using outlier analysis[J]. Journal of Sound and Vibration, 2000, 229(3): 647-667.
相关标签搜索:Function: exampleDLAR MatLab培训 MatLab培训课程 MatLab在线视频教程 MatLab技术学习教程 MatLab软件教程 MatLab资料下载 MatLab代做 MatLab基础知识 Fluent、CFX流体分析 HFSS电磁分析 Ansys培训 Abaqus培训