clear all; cput1=now; y=auread('miners.au',[950 1109]); s=y'; s10=s; tkrx=1; er(1:160)=0; M=[1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106 113 120 127 134 141 148 155]; e(1:160)=0; hw1(1:320)=0; prcss=1; tempx=0; N=160; a=lpc(s(1:N),10); tempy=(prcss-1)*10; atemp(tempy+1:tempy+10)=-a(2:11); e(1)=1; hj=az160(a,e); hw1(161:320)=hj(1:160); e(1)=0; psi(1:length(M))=0; for syc=1:length(M), for n=1:160, psi(syc)=psi(syc)+s(n)*hw1(161-M(syc)+n); end end clear epsi; epsi(length(M),length(M))=0; for syc=1:length(M), for syc2=1:length(M), for g=1:160, epsi(syc,syc2)=epsi(syc,syc2)+hw1(161-M(syc)+g)*hw1(161-M(syc2)+g); end end end epsi2=inv(epsi); gi=psi*epsi2; for syc=1:length(M), er(M(syc)+tempx)=gi(syc); end salg1=az160(a,er); ealg1=er; aalg1=a; cput1=now-cput1; cput1 %now algorithm2 clear e er a hw1 sn c ex y=auread('miners.au',[950 1109]); s=y'; sorig=s; N=160; er(1:160)=0; a=lpc(s(1:N),10); e(1:160)=0; e(1)=1; sn(161:320)=az160(a,e); hw1=sn; e(1)=0; ex(1:160)=0; for ij=0:22, c(1:N)=0; for ts=1:N, for st=1:N, c(ts)=c(ts)+(s(st)-sn(161+st-ts))^2; end c(ts)=c(ts)/(N+1-ts); end [val pos]=min(c); while abs(ex(pos))>0.0 tmp=max(c); c(pos)=tmp; [val pos]=min(c); end temp1=0;temp2=0; for syc=1:160, temp1=temp1+s(syc)*hw1(161+syc-pos); temp2=temp2+hw1(161+syc-pos)*hw1(161+syc-pos); end ex(pos)=temp1/temp2; gain=temp1/temp2; s=s-(gain*hw1(161:320)); end cput1=now-cput1; cput1 s1=az160(a,ex); s2=salg1; xcoord=1:160; subplot(4,1,1), plot(sorig); subplot(4,1,2), plot(xcoord,s1,'o',xcoord,sorig,'-'); subplot(4,1,3), plot(xcoord,s2,'o',xcoord,sorig,'-'); subplot(4,1,4), plot(s1-s2); figure subplot(2,1,1), plot(ex); subplot(2,1,2), plot(ealg1);