function present_vrann1() x_min=212; y_min=119; x_max=592; y_max=454; close; sample=load_sample('tim29.wav'); play_sample(sample); figure(1) set(1,'Position',[x_min,y_min,x_max,y_max]) subplot(2,1,1); plot(sample); title('DIGITAL SOUND WAVE SAMPLE'); ylabel('amplitude'); xlabel('time'); pause; sample_fourier=abs(fft(sample).^2); play_sample(sample_fourier); subplot(2,1,2); plot(sample_fourier(1:500),'r'); title('FOURIER TRANSFORM -- FFT CONVERSION'); xlabel('frequency'); ylabel('power'); pause; close; sample_bin=sample_bins(sample); figure(2) subplot(2,1,1); set(2,'Position',[x_min,y_min,x_max,y_max]) plot(sample_fourier(1:500),'r'); title('FOURIER TRANSFORM -- FFT CONVERSION'); xlabel('frequency'); ylabel('power'); subplot(2,1,2); plot(sample_bin,'r'); title('SIGNAL TO BIN ASSIGNMENTS'); xlabel('frequency bin'); ylabel('max power index'); pause; close; b=dlmread('c:\temp\drake_p.dat'); c=dlmread('c:\temp\hoai_p.dat'); d=dlmread('c:\temp\khoat_p.dat'); e=dlmread('c:\temp\tim_p.dat'); f=sample_bins(sample); figure(3) subplot(2,1,1); set(3,'Position',[x_min,y_min,x_max,y_max]) plot(1:50,b,'c',1:50,c,'b',1:50,d,'g',1:50,e,'k') title('PROTOTYPE VECTORS'); xlabel('frequency bins'); ylabel('modular index'); subplot(2,1,2); plot(1:50,b,'.c',1:50,c,'.b',1:50,d,'.g',1:50,e,'.k') text(2,10.5,'max index values') title('PROTOTYPES'); xlabel('frequency bins'); ylabel('modular index'); pause; close; figure(3) subplot(2,1,1); set(3,'Position',[x_min,y_min,x_max,y_max]) plot(1:50,b,'.c',1:50,c,'.b',1:50,d,'.g',1:50,e,'.k') text(2,10.5,'max index values') title('PROTOTYPES'); xlabel('frequency bins'); ylabel('modular index'); subplot(2,1,2); plot(1:50,b,'.c',1:50,c,'.b',1:50,d,'.g',1:50,e,'.k',1:50,f,'r') text(6,11,'input vector') title('INPUT VECTOR VS PROTOTYPES'); xlabel('frequency bin'); ylabel('max power index'); pause; close; w=abs(f-b); x=abs(f-c); y=abs(f-d); z=abs(f-e); temp=[w,x,y,z]'; distance=min(temp(1:4,1:50)); id(1:50)=0; for I=1:50 if(distance(I)==w(I)) id(I)=id(I)*4+1; end if(distance(I)==x(I)) id(I)=id(I)*4+2; end if(distance(I)==y(I)) id(I)=id(I)*4+3; end if(distance(I)==z(I)) id(I)=id(I)*4+4; end end for I=1:50 mode1(I)=-1; mode2(I)=-1; mode3(I)=-1; mode4(I)=-1; if(id(I)==1) mode1(I)=1; end if(id(I)==2) mode2(I)=2; end if(id(I)==3) mode3(I)=3; end if(id(I)==4) mode4(I)=4; end end figure(4) subplot(2,1,1); set(4,'Position',[x_min,y_min,x_max,y_max]) plot(1:50,b,'.c',1:50,c,'.b',1:50,d,'.g',1:50,e,'.k',1:50,f,'r') text(6,11,'input vector') title('INPUT VECTOR VS PROTOTYPES'); xlabel('frequency bin'); ylabel('max power index'); subplot(2,1,2); plot(1:50,mode1,'.c',1:50,mode2,'.b',1:50,mode3,'.g',1:50,mode4,'.k') title('CLASSIFICATION'); ylabel('number of hits'); xlabel('input vector'); axis([0 50 0 5]) text(51,1,'Drake') text(51,2,'Hoai') text(51,3,'Khoat') text(51,4,'Tim') pause close compare_prototypes(load_sample('drake1.wav')); catalog_a(ann(load_sample('drake1.wav'))); set(1,'Position',[x_min,y_min,x_max,y_max]) pause close compare_prototypes(load_sample('hoai1.wav')); catalog_a(ann(load_sample('hoai1.wav'))); set(1,'Position',[x_min,y_min,x_max,y_max]) pause close compare_prototypes(load_sample('khoat1.wav')); catalog_a(ann(load_sample('khoat1.wav'))); set(1,'Position',[x_min,y_min,x_max,y_max]) pause close compare_prototypes(load_sample('tim1.wav')); catalog_a(ann(load_sample('tim1.wav'))); set(1,'Position',[x_min,y_min,x_max,y_max]) pause a=load_sample('__a.wav'); b=load_sample('__b.wav'); c=load_sample('__c.wav'); play_sample(a);pause(2);play_sample(b);pause(2);play_sample(c) close