%% Impedance calculation

function [imp] = impedance(h,w,e)
if w/h < 1
    ef = (e+1)/2+(e-1)/2*((1+12*(h/w))^(-1/2)+0.04*(1-(w/h))^2);
    imp = 60/sqrt(ef)*log(8*h/w+0.25*w/h);
else
    ef = (e+1)/2+(e-1)/2*(1+12*(h/w))^(-1/2);
    imp = 120*pi/(sqrt(ef)*(w/h+1.393+2/3*log(w/h+1.444)));
end