Nonlinear optimization technique for the homogenization of metamaterials from scattering parameters