function[amp,ramp,emax1,emax2]=werror(xabs,xmin,xmax,srs_spec,last_srs,last_wavelet,rrr,amp,ramp,emax1,emax2,ijk);       
%
	em1=0.;
	ew1=0.;
%
	em2=0.;
	ew2=0.;
%    
    emax1=1.*emax1;
    emax2=1.*emax2;   
    amp=1.*amp;
%
	for(i=1:last_srs)
        ew1=abs(20.*log10(xabs(i)/srs_spec(i)));
		if( ew1>em1)
			em1=ew1;
         end
        em2=em2+abs(20.*log10(abs(xmin(i)/srs_spec(i))));
        em2=em2+abs(20.*log10(abs(xmax(i)/srs_spec(i))));       
    end
%
em2=em2/last_srs;
%
	if( (em1*em2) < emax1)
%
        emax1=(em1*em2);
%       
		amp=amp.*rrr;
        ramp=amp;
        out1=sprintf(' %d  %9.5g  %9.5g  %9.5g  %9.5g *',ijk,em1,em2,(em1*em2),emax1);
%
    else
        out1=sprintf(' %d  %9.5g  %9.5g  %9.5g %9.5g ',ijk,em1,em2,(em1*em2),emax1);       
    end
%    
    disp(out1);    