One model that will help you is the admittedly dated (1981) Preliminary Earth Reference Earth Model. It provides density models for the inner and outer core as functions of distance from the center of the Earth: $$ \rho = \begin{cases} 13.0885 - 8.8381 x^2 & \quad \phantom{000}0\phantom{.0} \le r \le 1221.5 \\ 12.5815 - 1.2638 x - 3.6426 x^2 - 5.5281 x^3 & \quad 1221.5 \le r \le 3480.0 \end{cases} $$ where
- $\rho$ is the density in grams per cubic centimeter,
- $r$ is distance from the center of the Earth to the point of interest in kilometers, and
- $x$ is the normalized radius: $x\equiv\frac r {6371}$.
Note that this results in a slight density discontinuity at the boundary between the inner and outer core (1221.5 km). That's intentional. There have been later upgrades to the PREM, but the PREM is where it all starts.
Reference: