资源简介
使用svm分类器对已知数据进行故障分类。
代码片段和文件信息
clc
clear all
close all
%数据准备
% A=xlsread(‘C:\Users\lenovo\Desktop\SVMinput.xls‘);
% b=textread(‘C:\Users\lenovo\Desktop\data\jiangui2\fly1_4.txt‘);
% n=length(A);
% for i=0:108
% j=i+1;
% data=A((99*i+1:99*(1+i))2);
% u(j1)=mean(abs(data));
% u(j2)=j;
% xrms(j1)=sqrt(sum(data.^2)/n);
% xrms(j2)=j;
% % k(j1)=kurtosis(data);
% % k(j2)=j;
% xp(j1)=max(abs(data));
% xp(j2)=j;
% u=sortrows(u1);
% xrms=sortrows(xrms1);
% % k=sortrows(k1);
% xp=sortrows(xp1);
% my=[u(:2)xrms(:2)xp(:2)];
% end
% 第一步
% A=textread(‘C:\Users\lenovo\Desktop\data\dataSVM1\1.txt‘);
% label_t=vertcat(A((1:90)1)A((111:155)1)A((166:210)1));
% data_t=vertcat(A((1:90)(2:4))A((111:155)(2:4))A((166:210)(2:4)));
% label_p=vertcat(A((91:110)1)A((156:165)1)A((211:220)1));
%
% data_p=vertcat(A((91:110)(2:4))A((156:165)(2:4))A((211:220)(2:4)));
% model = svmtrain(label_t data_t‘-c 100 -h 1 1 -t 1 -g 0. -d 1 -b 0 -r 0 ‘)
% [predict_label accuracy dec_values] = svmpredict(label_t data_t model);
% [predict_label1 accuracy dec_values] = svmpredict(label_p data_pmodel);
% 第二步
% for i=0:35
% j=i+1;
% name=strcat(‘C:\Users\lenovo\Desktop\dataSVMS\super_high\fry1_‘num2str(2)‘.txt‘);
% A=textread(name);
% data=A((299*i+1:299*(1+i))2);
% n=length(A);
% u(j1)=mean(abs(data));
% u(j2)=j;
% xrms(j1)=sqrt(sum(data.^2)/n);
% xrms(j2)=j;
% k(j1)=kurtosis(data);
% k(j2)=j;
% xp(j1)=max(abs(data));
% xp(j2)=j;
% u=sortrows(u1);
% xrms=sortrows(xrms1);
% k=sortrows(k1);
% xp=sortrows(xp1);
% my=[uxrmskxp];
% end
% A=textread(‘C:\Users\lenovo\Desktop\data\dataSVM1\2.txt‘);
% label_t=vertcat(A((1:50)1)A((71:120)1));
% data_t=vertcat(A((1:50)(2:4))A((71:120)(2:4)));
% label_p=vertcat(A((51:70)1)A((121:135)1));
% data_p=vertcat(A((51:70)(2:4))A((121:135)(2:4)));
% model = svmtrain(label_t data_t‘-c 100 -h 1 1 -t 1 -g 0. -d 1 -b 0 -r 0 ‘)
% [predict_label accuracy dec_values] = svmpredict(label_t data_t model);
% [predict_label1 accuracy dec_values] = svmpredict(label_p data_pmodel);
% 第三步
% clc
% clf
%
- 上一篇:ICA原理及matlab实现
- 下一篇:三分类_svm_matlab
评论
共有 条评论