Suppose I have an increasing step function $E_c$ given by $$E_c(\phi) = \sum_{i=1}^n E_i \theta(\phi - \phi_i),$$ where $\theta$ is the Heaviside step function and $E_i$, $\phi$, and $\phi_i$ are all and real and $n$ is a small integer, approximately 6. (Also, $E_i > 0$ and $ 0 < \phi_i \leq 2\pi$.)
I want to find a line such that the area between the line and the step function is minimized. That is, I want to find $m$ and $\phi_0$ to minimize $A$, where $$A = \int_0^{2\pi} |E_c - m(\phi - \phi_0)|d\phi.$$
Does anyone know whether methods have already been developed to do this? Thanks!