An electronic apparatus is provided. The electronic apparatus includes a speaker, a first
microphone, a second
microphone, memory storing one or more computer programs, and one or more processors communicatively coupled to the speaker, the first
microphone, the second microphone, and the memory, wherein the one or more computer programs include computer-
executable instructions that, when executed by the one or more processors individually or collectively, cause the electronic apparatus to control an external speaker to output sound of a first frequency, obtain a first sound
signal corresponding to the sound of the first frequency through the first microphone, and obtain a
second sound signal including the first sound
signal through the second microphone, obtain a first
noise cancelling signal based on the first sound signal and the
second sound signal, output a second
noise cancelling signal in which at least one of a phase or a
gain of the first
noise cancelling signal is changed and a third sound signal of a second frequency through the speaker, obtain the
second sound signal by changing at least one of the phase or the
gain, and identify at least one of a target phase or a target
gain based on a third frequency component related to
distortion product otoacoustic emissions (DPOAE) of the first frequency and the second frequency included in the second sound signal.