function [Je]=conerror(rd0,rx,P,mu,w0,nite); % % function [Je]=conerror(rd0,rx,P,mu,w0,nite); % % dibuja el contorno de la superficie de error y la evolucion del error % % Entradas % % rd0 ..... potencia señal deseada % rx ...... función de autocorrelación señal datos % P ....... vector correlación cruzada % mu ...... paso de adaptación % w0 ...... vector inicial % nite .... numero de iteraciones % % Salidas % % Je ...... curva de aprendizaje figure(1) clf Rx=toeplitz(rx); [V,D]=eig(Rx); D V fprintf(1,'Dispersion de autovalores %f\n',D(2,2)/D(1,1)); hopt=inv(Rx)*P Jmin=rd0-P'*hopt; h1min=hopt(1)-2; h1max=hopt(1)+2; h2min=hopt(2)-2; h2max=hopt(2)+2; n1=1; n2=1; for h1=h1min:0.05:h1max for h2=h2min:0.05:h2max h=[h1 h2].'; J(n1,n2)=Jmin+(h-hopt)'*Rx*(h-hopt); n2=n2+1; end n2=1; n1=n1+1; end h1=h1min:0.05:h1max; h2=h2min:0.05:h2max; contour(h1,h2,J,50); hold on plot(hopt(1),hopt(2),'*r'); want=w0; w1(1)=w0(1); w2(1)=w0(2); plot(w1(1),w2(1),'og'); Je(1)=Jmin+(w0-hopt)'*Rx*(w0-hopt); for n=2:nite w=want+mu*(P-Rx*want); w1(n)=w(1); w2(n)=w(2); plot(w(1),w(2),'og'); want=w; Je(n)=Jmin+(w-hopt)'*Rx*(w-hopt); end plot(w1,w2); figure(2) clf plot(w1); hold on plot(ones(nite,1)*hopt(1)); plot(w2,'g'); plot(ones(nite,1)*hopt(2),'g'); grid on