Function: exampleDLAR
2017-01-16 by:CAE仿真在線 來(lái)源:互聯(lián)網(wǎng)
Function: exampleDLAR
% 程序版權(quán)歸原作者所有。本人只是對(duì)源代碼略作注釋。目的是供自己今后使用少花時(shí)間。
% 該程序由原作者免費(fèi)共享提供,不作商業(yè)用途的前提下,本人才得以拿出來(lái)供同行
% 及對(duì)matlab編程有興趣的朋友分享、共同學(xué)習(xí)。
% 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'); %導(dǎo)入數(shù)據(jù)文件
% 原數(shù)據(jù)格式為8192個(gè)樣本點(diǎn),5個(gè)通道,第1通道為激勵(lì),第2至5通道為響應(yīng);
% 數(shù)據(jù)第3維為測(cè)量次數(shù),共170次,
data=dataset(:,2:5,:); %也就是說(shuō)本程序使用的數(shù)據(jù)為全部170次測(cè)量的第2至5通道響應(yīng)數(shù)據(jù)
% 以下代碼為將第1次測(cè)量的響應(yīng)數(shù)據(jù)4個(gè)通道畫(huà)在圖中。效果如下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模型階數(shù)為15,這里選擇了確定的數(shù),實(shí)際在處理未知數(shù)據(jù)時(shí)需要進(jìn)行試算確定
% AR model order:
arOrder=15;
%% 估計(jì)AR模型參數(shù),就是AR系數(shù),下面程序?qū)⒂?jì)算出170次測(cè)量數(shù)據(jù)的AR系數(shù)
% 4個(gè)通道,170次,每個(gè)響應(yīng)的AR系數(shù)有15個(gè),最后形成的矩陣為170*60
% Estimation of the AR Parameters:
[arParameters]=arModel_shm(data,arOrder);
[n m]=size(arParameters); % n = 170, m = 60;
% 畫(huà)出AR系數(shù)圖,并將未損用黑色表示,損傷用紅色表示,如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')
% 以下特征提取方法與診斷過(guò)程參考文獻(xiàn)[1]
% 檢測(cè)方法原理如下
%
% 1. 訓(xùn)練樣本取自結(jié)構(gòu)健康狀態(tài)的特征數(shù)據(jù),計(jì)算其均值 與協(xié)方差矩陣
% 2. 測(cè)試樣本取自結(jié)構(gòu)任意狀態(tài)的特征數(shù)據(jù),計(jì)算其到訓(xùn)練樣本的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個(gè)健康工況第1至9次測(cè)量的AR系數(shù)作為訓(xùn)練樣本,每個(gè)工況的第10次作為測(cè)試樣本
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個(gè)工況的前9次測(cè)量的樣本進(jìn)行訓(xùn)練,獲得模型model
[model]=learnMahalanobis_shm(learnData);
% 用model計(jì)算17個(gè)工況第10次測(cè)量的測(cè)試樣本,
DI(:,i)=scoreMahalanobis_shm(scoreData,model);
cnt=cnt+arOrder;
end
%取指標(biāo)的相反數(shù)
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>
參考文獻(xiàn)
[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.
相關(guān)標(biāo)簽搜索:Function: exampleDLAR MatLab培訓(xùn) MatLab培訓(xùn)課程 MatLab在線視頻教程 MatLab技術(shù)學(xué)習(xí)教程 MatLab軟件教程 MatLab資料下載 MatLab代做 MatLab基礎(chǔ)知識(shí) Fluent、CFX流體分析 HFSS電磁分析 Ansys培訓(xùn) Abaqus培訓(xùn)