各种SVM分类算法

源代码在线查看: 熵比例系数new.m

软件大小: 8283 K
上传用户: fd82uvj8r
关键词: SVM 分类算法
下载地址: 免注册下载 普通下载 VIP

相关代码

				clear all
				 for i=1:20
				   fname=sprintf('D:\\study\\师姐论文\\邢峰师姐\\邢峰论文程序\\邢峰论文程序\\audio files\\speech with music\\%d.wav',i);
				   x=wavread(fname);
				   x=x(:,1);
				   [c,l]=wavedec(x,3,'db4');
				   ca=appcoef(c,l,'db4',3);%近似系数
				   x=ca;
				   enframex=enframe(x,128,64);%对信号x分帧处理,每帧有128个采样点,相邻帧之间有50%的叠加率
				   [row,col]=size(enframex);%返回行,列,每一行代表一帧,每一列表示1到128个采样点
				   A=abs(enframex).^2;
				   energy=zeros(row,1);
				   for j=1:row
				     energy(j)=sum(A(j,:));
				   end
				   for j=1:row
				     s(j)=0;
				     s(j)=s(j)+energy(j).*log10(energy(j));
				   end
				   Err=-s;swm1(i)=0;swm2(i)=0;
				   for k=1:row
				       if Err(1,k)				          swm1(i)=swm1(i)+1;
				          if  Err(1,k)				              swm2(i)=swm2(i)+1;   
				          end
				       end
				   end   
				   swmshangbi1(i,1)=swm1(i)/row;
				   swmshangbi2(i,1)=swm2(i)/row;
				  end
				   swmshangbi1
				   swmshangbi2
				
				
				clear
				for i=1:20
				   fname=sprintf('D:\\study\\师姐论文\\邢峰师姐\\邢峰论文程序\\邢峰论文程序\\audio files\\speech\\%d.wav',i);
				   x=wavread(fname);
				   x=x(:,1);
				   [c,l]=wavedec(x,3,'db4');
				   ca=appcoef(c,l,'db4',3);%近似系数
				   x=ca;
				   enframex=enframe(x,128,64);%对信号x分帧处理,每帧有128个采样点,相邻帧之间有50%的叠加率
				   [row,col]=size(enframex);%返回行,列,每一行代表一帧,每一列表示1到128个采样点
				   A=abs(enframex).^2;
				   energy=zeros(row,1);
				   for j=1:row
				     energy(j)=sum(A(j,:));
				   end
				   for j=1:row
				     s(j)=0;
				     s(j)=s(j)+energy(j).*log10(energy(j));
				   end
				   Err=-s;speech1(i)=0;speech2(i)=0;
				   for k=1:row
				       if Err(1,k)				          speech1(i)=speech1(i)+1;
				          if Err(1,k)				              speech2(i)=speech2(i)+1;
				          end
				       end
				   end    
				   speechshangbi1(i,1)=speech1(i)/row;
				   speechshangbi2(i,1)=speech2(i)/row;
				  end
				   speechshangbi1
				   speechshangbi2
				
				clear
				for i=1:20
				   fname=sprintf('D:\\study\\师姐论文\\邢峰师姐\\邢峰论文程序\\邢峰论文程序\\audio files\\music\\%d.wav',i);
				   x=wavread(fname);
				   x=x(:,1);
				   [c,l]=wavedec(x,3,'db4');
				   ca=appcoef(c,l,'db4',3);%近似系数
				   x=ca;
				   enframex=enframe(x,128,64);%对信号x分帧处理,每帧有128个采样点,相邻帧之间有50%的叠加率
				   [row,col]=size(enframex);%返回行,列,每一行代表一帧,每一列表示1到128个采样点
				   A=abs(enframex).^2;
				   energy=zeros(row,1);
				   for j=1:row
				     energy(j)=sum(A(j,:));
				   end
				   for j=1:row
				     s(j)=0;
				     s(j)=s(j)+energy(j).*log10(energy(j));
				   end
				   Err=-s;music1(i)=0;music2(i)=0;
				   for k=1:row
				       if Err(1,k)				          music1(i)=music1(i)+1;
				          if Err(1,k)				              music2(i)=music2(i)+1;
				          end    
				       end
				   end
				   musicshangbi1(i,1)=music1(i)/row;
				   musicshangbi2(i,1)=music2(i)/row;
				   end
				   musicshangbi1
				   musicshangbi2			

相关资源