  In this paper we study scalar perturbations of the metric for nonlinear
$f(R)$ models. We consider the Universe at the late stage of its evolution and
deep inside the cell of uniformity. We investigate the astrophysical approach
in the case of Minkowski spacetime background and two cases in the cosmological
approach, the large scalaron mass approximation and the quasi-static
approximation, getting explicit expressions for scalar perturbations for both
these cases. In the most interesting quasi-static approximation, the scalar
perturbation functions depend on both the nonlinearity function $f(R)$ and the
scale factor $a$. Hence, we can study the dynamical behavior of the
inhomogeneities (e.g., galaxies and dwarf galaxies) including into
consideration their gravitational attraction and the cosmological expansion,
and also taking into account the effects of nonlinearity. Our investigation is
valid for functions $f(R)$ which have stable de Sitter points in future with
respect to the present time, that is typical for the most popular $f(R)$
models.
