Solid state nuclear magnetic resonance studies of functional materials