• 大小: 13KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-04-29
  • 语言: Matlab
  • 标签: VM  电能质量  pca  信号  

资源简介

使用小波能量差提取信号,PCA降维,SVM对电能质量扰动分类。

资源截图

代码片段和文件信息

tic
clearclose all 
%% 无随机取,取1到9个连续整周波扰动,在十个整周波上,(含噪),200个测试集全部模型 
 
w=100*pi;  
t=0:1/6400:0.2;%取1028 2^10=1024 
t1=0.071; 
t2=0.142; 
%pure sin  正常正弦

figure(1);
for c1=1:1:200; 
subplot(411); 
 u0(c1:)=sin(w*t); 
 plot(tu0); 
 ylabel(‘幅值‘);
 xlabel(‘t/s‘);
 title(‘正常电压波形‘);  
end

%% swell 电压骤升
for c1=1:1:200; 
subplot(412); 
u(c1:)=sin(w*t).*(1+0.5*(heaviside(t-t1)-heaviside(t-t2))); 
plot(tu);
ylabel(‘幅值‘);
xlabel(‘t/s‘);
title(‘电压骤升波形‘); 
end 

%% sag 电压骤降

for c1=1:1:200; 
v(c1:)=sin(w*t).*(1-0.8*(heaviside(t-t1)-heaviside(t-t2))); 
subplot(413);
plot(tv);
 ylabel(‘幅值‘);
 xlabel(‘t/s‘);
 title(‘电压骤降波形‘); 
end 

%% interupt  电压中断
for c1=1:1:200; 
vi(c1:)=sin(w*t).*(1-1*(heaviside(t-t1)-heaviside(t-t2))); 
subplot(414);
plot(tvi); 
 ylabel(‘幅值‘);
 xlabel(‘t/s‘);
 title(‘电压中断波形‘); 
end 
%% homonics  谐波(间)
figure(2);
for c1=1:1:200; 
 vv(c1:)=sin(w*t)+[0.1*sin(3*w*t)+0.1*sin(5*w*t)+0.1*sin(7*w*t)].*(heaviside(t-t1)-heaviside(t-t2)); 
 subplot(411); 
plot(tvv); 
 ylabel(‘幅值‘);
 xlabel(‘t/s‘);
 title(‘谐波波形‘); 
end 

%% pluse 暂态脉冲

for c1=1:1:200; 
z(c1:) =sin(w*t).*(1-2*(heaviside(t-0.071)-heaviside(t-0.07115625))-2*(heaviside(t-0.142)-heaviside(t-0.14215625)));  
% [z11t3] = gensig(‘pulse‘t10.20.00015625);%1.2  0.0011673152 
% z1(c1:)=sin(w*t)+[0.4*z11]‘;%幅度0.1-0.8 
subplot(412);
plot(tz);
 ylabel(‘幅值‘);
 xlabel(‘t/s‘);
 title(‘暂态脉冲波形‘); 
end 
%%%%%[u  t]=gensig(type  tau tf  ts)
%%%%%Type—输入信号类型(sin正弦信号; square 方波信号 ;pulse周期脉冲信号)
%%%%%Tau—输入信号的周期  tf—信号的持续时间  ts—信号时间的步长
%%%%%  [u  t]—输出信号历史记录

%% osc 暂态振荡
for c1=1:1:200; 
zz(c1:)=sin(w*t)+0.4*exp(10*(t1-t2))*sin(20*w*t).*(heaviside(t-t1)-heaviside(t-t2));%取20比较象 osc.m 
subplot(413);
plot(tzz);
 ylabel(‘幅值‘);
 xlabel(‘t/s‘);
 title(‘暂态振荡波形‘); 
end 

%% flicker 电压闪变
for c1=1:1:200;
  g(c1:)=sin(w*t).*[1+(0.1*(sin(5*w*t)+0.5*sin(10*w*t)+(1/3)*sin(15*w*t))).*(1*(heaviside(t-t1)-heaviside(t-t2)))];
 subplot(414);
plot(tg);
 ylabel(‘幅值‘);
 xlabel(‘t/s‘);
 title(‘电压闪变波形‘); 
end

%% 小波分解与能量系数提取
  for c1=1:1:200; 
  
[c0l0]=wavedec(u0(c1:)10‘db4‘);
[Ea0Ed0(c1:)] = wenergy(c0l0);

[culu]=wavedec(u(c1:)10‘db4‘); 
[EauEdu(c1:)] = wenergy(culu);
 EDu(c1:) = Edu(c1:)-Ed0(c1:);

[cvlv]=wavedec(v(c1:)10‘db4‘); 
[EavEdv(c1:)] = wenergy(cvlv); 
 EDv(c1:) = Edv(c1:)-Ed0(c1:);

[cvilvi]=wavedec(vi(c1:)10‘db4‘); 
[EaviEdvi(c1:)] = wenergy(cvilvi); 
EDvi(c1:) = Edvi(c1:)-Ed0(c1:);

[cvvlvv]=wavedec(vv(c1:)10‘db4‘);  
[EavvEdvv(c1:)] = wenergy(cvvlvv);  
EDvv(c1:) = Edvv(c1:)-Ed0(c1:);

[czlz]=wavedec(z(c1:)10‘db4‘); 
[EazEdz(c1:)] = wenergy(czlz); 
EDz(c1:) = Edz(c1:)-Ed0(c1:);

[czzlzz]=wavedec(zz(c1:)10‘db4‘); 
[EazzEdzz(c1:)] = wenergy(czzlzz); 
 EDzz(c1:) = Edzz(c1:)-Ed0(c1:);

[cglg]=wavedec(g(c1:)10‘db4‘); 
[EagEdg(c1:)] = wenergy(cglg); 
EDg(c1:) = Edg(c1:)-Ed0(c1

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       8723  2012-03-22 15:14  pq_pcasvm\buhanzaoxiaobonengliangcha.m

     文件       9270  2012-03-24 23:07  pq_pcasvm\hanzaoxiaobonengliangcha002.m

     文件       9698  2012-06-22 21:24  pq_pcasvm\hanzaoxiaobonengliangcha01.m

     文件       4640  2012-06-29 14:43  pq_pcasvm\PCASVM.m

     文件       2637  2012-05-21 14:43  pq_pcasvm\pcv1.m

     文件       6483  2012-06-22 21:26  pq_pcasvm\xiaobonengliangcha.m

     目录          0  2012-07-23 09:39  pq_pcasvm

----------- ---------  ---------- -----  ----

                41451                    7


评论

共有 条评论