function rm = complex_rmse(Hm,Hc)

% weight imaginary part more heavily near resonance

wr = abs(imag(Hm));
wr = wr / max(wr);     % normalize weights

err = (real(Hm)-real(Hc)).^2 ...
    + 4*wr.*(imag(Hm)-imag(Hc)).^2;

rm = sqrt(mean(err));

end