A method and an apparatus detect and compensate for a mechanical resonance frequency
occurring in a system. The apparatus includes an excitation unit that increases
a gain of a predetermined frequency band of a driving signal, a resonance frequency
detector frequency-transforming a response signal, and detecting the resonance
frequency in a frequency domain, an excitation signal generator separately generating
a first excitation signal and a second excitation signal, a mixer mixing one of
the first excitation signal or the second excitation signal with a driving signal
that does not pass through the excitation unit, and inputting a result of the combination
to the system, a resonance determination unit determining whether resonance occurs
in the system, and a system controller determining a frequency of one of the first
excitation signal or the second excitation signal input when resonance occurs in
the system, as the resonance frequency.