We propose an experimental setup of ultracold fermions in an optical lattice to determine the pairing gap in a superfluid state and the spin ordering in a Mott-insulating state. The idea is to apply a periodic modulation of the lattice potential and to use the thereby induced double occupancy to probe the system. We show by full time-dependent calculation using the adaptive time dependent density-matrix renormalization group method that the position of the peak in the spectrum of the induced double occupancy gives the pairing energy in a superfluid and the interaction energy in a Mott-insulator, respectively. In the Mott-insulator we relate the spectral weight of the peak to the spin ordering at finite temperature using perturbative calculations.