💥💥💞💞欢迎来到本博客❤️❤️💥💥
🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。
⛳️座右铭:行百里者,半于九十。
📋📋📋本文目录如下:🎁🎁🎁
💥1 概述
随着无人机技术的迅速发展,无人机在多个领域得到了广泛应用,包括航拍、测绘、物流、农业、军事等。然而,由于无人机在复杂的环境中运行,其可能会面临各种故障风险。及时准确地进行故障检测和诊断对于确保无人机的安全运行、提高任务成功率以及降低维护成本至关重要。 故障检测的重要性 1. 保障飞行安全:无人机在飞行过程中如果出现故障,可能会导致坠毁,对人员和财产造成严重威胁。通过故障检测,可以及时发现潜在问题,采取相应措施避免事故发生。 2. 提高任务可靠性:故障检测能够确保无人机在执行任务过程中保持良好的性能状态,提高任务的可靠性和成功率。 3. 降低维护成本:早期发现故障可以减少故障的严重程度,降低维修难度和成本。 总之,无人机故障检测和诊断是确保无人机安全运行和高效执行任务的重要环节。随着技术的不断进步,故障检测和诊断方法将不断完善,为无人机的广泛应用提供更加可靠的保障。
📚2 运行结果

主函数部分代码:
% Select the number of classes
classNum = 2;
feature_vec = sensor_sim_out';
% normal = repmat('normal', length(sensor_sim_out_normal'), 1);
% normal = cellstr(normal);
% fault = repmat('fault', length(sensor_sim_out_fault'), 1);
% fault = cellstr(fault);
% output_vec = vertcat(normal, fault);
output_vec = faultLabel;
%% Arrange training/test sets
% feature_vec_training .:. feature matrix for training
% output_vec_training .:. output vector for training
% training set (around %70 percent of whole data set)
trainingDataExNum = ceil(80 / 100 * (length(feature_vec)));
% Select %70 of data for training and leave the rest for testing
randomSelectionColoumnNum = randperm(length(feature_vec),trainingDataExNum);
% Training set for feature and output
feature_vec_training = feature_vec(randomSelectionColoumnNum, :);
output_vec_training = output_vec(randomSelectionColoumnNum, :);
% Test set for feature and output
feature_vec_test = feature_vec;
feature_vec_test(randomSelectionColoumnNum, :) = [];
output_vec_test = output_vec;
output_vec_test(randomSelectionColoumnNum, :) = [];
test_set_time = t_s;
test_set_time(randomSelectionColoumnNum) = [];
%% TRAINING PHASE
% SVMModel is a trained ClassificationSVM classifier.
tic
SVMModel = fitcsvm(feature_vec_training,output_vec_training,'Standardize', true, 'ClassNames',{'nominal','fault'});
toc
% Support vectors
sv = SVMModel.SupportVectors;
ScoreSVMModel = fitPosterior(SVMModel);
%% CROSS VALIDATION
% 10-fold cross validation on the training data
% inputs : trained SVM classifier (which also stores the training data)
% outputs : cross-validated (partitioned) SVM classifier from a trained SVM
% classifier
% CVSVMModel is a ClassificationPartitionedModel cross-validated classifier.
% ClassificationPartitionedModel is a set of classification models trained
% on cross-validated folds.
CVSVMModel = crossval(SVMModel);
% Assess performance of classification via Matlab tools
% To assess predictive performance of SVMModel on cross-validated data
% "kfold" methods and properties of CVSVMModel, such as kfoldLoss is used
% Evaluate 10-fold cross-validation error.
% (Estimate the out-of-sample misclassification rate.)
crossValClassificErr = kfoldLoss(CVSVMModel);
% Predict response for observations not used for training
% Estimate cross-validation predicted labels and scores.
[elabel,escore] = kfoldPredict(CVSVMModel);
max(escore)
min(escore)
% [ScoreCVSVMModel,ScoreParameters] = fitSVMPosterior(CVSVMModel);
%% Assess performance of classification via confusion matrix
%% FIT POSTERIOR PROBABILITES fitPosterior(SVMModel) / fitSVMPosterior(CVSVMModel)
% "The transformation function computes the posterior probability
% that an observation is classified into the positive class (SVMModel.Classnames(2)).
% The software fits the appropriate score-to-posterior-probability
% transformation function using the SVM classifier SVMModel, and
% by conducting 10-fold cross validation using the stored predictor data (SVMModel.X)
% and the class labels (SVMModel.Y) as outlined in REF : Platt, J.
% "Probabilistic outputs for support vector machines and comparisons
% to regularized likelihood methods". In: Advances in Large Margin Classifiers.
% Cambridge, MA: The MIT Press, 2000, pp. 61?74"
%% Plot results
figure
gscatter(feature_vec(:,1),feature_vec(:,2),output_vec)
hold on
plot(sv(:,1),sv(:,2),'ko','MarkerSize',10)
% legend('normal','fault','Support Vector')
legend('normal','fault')
hold off
set(legend,'FontSize',11);
xlabel({'$a_x$'},...
'FontUnits','points',...
'interpreter','latex',...
'FontSize',15,...
'FontName','Times')
ylabel({'$a_y$'},...
'FontUnits','points',...
'interpreter','latex',...
'FontSize',15,...
'FontName','Times')
print -depsc2 feat1vsfeat2.eps
🎉3 参考文献
文章中一些内容引自网络,会注明出处或引用为参考文献,难免有未尽之处,如有不妥,请随时联系删除。
[1]戴凌宇,程赟,冯张棋,等.基于故障发生程度的四旋翼无人机故障诊断[J].现代机械,2024(04):77-83.DOI:10.13667/j.cnki.52-1046/th.2024.04.004.
[2]江宜瑞,李宇,薛强,等.人工智能无人机在输电线路故障检测中的应用[J].工业控制计算机,2024,37(08):163-164.
1135

被折叠的 条评论
为什么被折叠?



