How to fit an odd relationship with a function?
The definition you gave is the definition of the function. This is called the Heaviside Step Function. There is not a simple analytic way to express it (like as a ratio, product, or composition  of trigonometric functions, exponentials, or polynomials). Note that it is neither continuous nor differentiable at x = 0. 

There are a couple of cool ways to represent it. The coolest and most intuitive way is as an integral of a Dirac Delta Function:

$$ 
H(x) = \int_{-\infty}^x { \delta(s)} \, \mathrm{d}s 
$$

Note, though, that a Dirac Delta Function is itself not an "official" function, since it is not well-defined at x = 0. Check out Distribution Theory for some cool info on weird "functions" like this.

Now, I think you may be trying to approximate this function, because you asked how to "fit" it. Taken straight from Wikipedia:

For a smooth approximation to the step function, one can use the logistic   function


$$
H(x) \approx \frac{1}{2} + \frac{1}{2}\tanh(kx) = \frac{1}{1+\mathrm{e}^{-2kx}},
$$

where a larger k corresponds to a sharper transition at x = 0.