%%%%%%%%%% crmz_plerror2.m %%%%%%%%%%
% plot error magnitude and real phase-rotated error. 
% 
EE1 = EE(iext(1));
EE_pl = [];
grd_pl = [];
i = 1; l = 0;
while (i < (length(indx_edges)-1))
  lo = l + 1;
  l = l + length([indx_edges(i):indx_edges(i+1)]);
  grd_pl = [grd_pl;grd(lo:l);nan];
  EE_pl = [EE_pl;EE(lo:l);nan];
  i = i + 2;
end;
lo = l + 1;
l = l + length([indx_edges(i):indx_edges(i+1)]);
grd_pl = [grd_pl;grd(lo:l)];
EE_pl = [EE_pl;EE(lo:l)];
EEE_pl = [real(EE_pl * conj(EE1/abs(EE1)) )-3*abs(delta),abs(EE_pl)]; 
EEE = [real(EE * conj(EE1/abs(EE1)) )-3*abs(delta), abs(EE)]; 
delr = real(delta);   deli = imag(delta);
axis('auto')
plot( grd_pl, EEE_pl, '-', [grd(1), 0.5], abs(delta)*[1;1], 'w--',...
 [grd(1), 0.5], abs(delta)*[1 -1;1 -1]-3*abs(delta), 'w:',...
  grd(jext), EEE(jext,:), 'o', grd(iext), EEE(iext,:), '+')
V = axis;
axis([-0.5*flag 0.5 V(3) V(4)])
%%%%%%%%%% End crmz_plerror2.m %%%%%%%%%%
