Electromagnetic processes in magnetic materials are described by Maxwell's equations. In ferrimagnetic insulators, assuming that D = epsilonE, we have the equation epsilon partial derivative(2)/partial derivativet(2) (H + 4piM) + c(2)curl(2) H = f(ext). In ferromagnetic metals. neglecting displacement currents and assuming Ohm's law. we instead get 4pisigma partial derivative/partial derivativet (H + 4piM) + c(2)curl(2) H = f(ext). Alternatively, under quasi-stationary conditions. for either material we can also deal with the magnetostatic equations: del (.) (H + 4piM) = 0, c curl H = 4pi J(ext). (Here f(ext) and J(ext) are prescribed time-dependent fields). In any of these settings, the dependence of M on H is represented by a constitutive law accounting for hysteresis: M = T(H), F being a vector extension of the relay model This is characterized by a rectangular hysteresis loop in a prescribed x-dependent direction, and accounts for high anisotropy and nonhomogeneity. The discontinuity in this constitutive relation corresponds to the possible occurrence of free boundaries. Weak formulations are provided for Cauchy problems associated with the above equations; existence of a solution is proved via approximation by time-discretization, derivation of energy-type estimates, and passage to the limit. An analogous representation is given for hysteresis in the dependence of P on E in ferroelectric materials. A model accounting for coupled ferrimagnetic and ferroelectric hysteresis is considered, too.