^I'm not sure how much you consider Enterprise to be canon, but the episode featuring the Constitution Class Defiant showed a unit of the artificial gravity system.
Each corridor or certain ones, had gravity units that generated an effect for a given area of the ship only, when shut down caused one deck or one section (much like the compartmental structure you've shown) to lose gravity, without effecting the ones above, below or around.
So you're idea of a system of localised units giving an "effect" of an unspecific nature in terms of our science seems to be how they do it. The units are behind shielded hatches on the floors and seem to be connected to a power grid but obviously not the mains as we've seen that go offline without loss of gravity before. So either generators or "batteries" of a sort.