Analysis of nanoindentation of soft materials with an atomic force microscope