  We demonstrate that proton and pion flow measurements in heavy-ion collisions
at incident energies ranging from 1 to 20 GeV per nucleon in the fixed target
frame can be used for an accurate determination of the symmetric nuclear matter
equation of state at baryon densities equal 2--4 times nuclear saturation
density $n_0$. We simulate Au+Au collisions at these energies using a hadronic
transport model with an adjustable vector mean-field potential dependent on
baryon density $n_B$. We show that the mean field can be parametrized to
reproduce a given density-dependence of the speed of sound at zero temperature
$c_s^2(n_B, T = 0)$, which we vary independently in multiple density intervals
to probe the differential sensitivity of heavy-ion observables to the equation
of state at these specific densities. Recent flow data from the STAR experiment
at the center-of-mass energies $\sqrt{s_{NN}} = \{3.0, 4.5 \}\ $ GeV can be
described by our model, and a Bayesian analysis of these data indicates a hard
equation of state at $n_B \in (2,3) n_0$ and a possible phase transition at
$n_B \in (3,4) n_0$. More data at $\sqrt{s_{NN}} = 2-5$ GeV, as well as a more
thorough analysis of the model systematic uncertainties will be necessary for a
more precise conclusion.
