# Find frequency/phase response of a microphone

I am trying to find the frequency/phase response of two cheap microphones bought off Ebay. Basically, I want to graph the frequency responses and phase responses of both microphones on the same axis so I can compare their sensitivity in MATLAB.

One approach I have read is downloading and playing a file that consists of pink noise through a speaker and simultaneously recording this using both microphones, then using the two recorded signals and the original pink noise file to get the bode plots. This is achieved by first taking the FFT of the recorded signals and of the original pink noise signal, and then using the bode function in MATLAB. The frequency/phase response of the speaker is unknown, however I'm more interested in the differences between the two microphones, so my thoughts are this wont affect my analysis. Any thoughts on this?

Is there an easier approach to finding the frequency/phase response of two microphones that I am not aware of using MATLAB?

• When you do FFT (i forgot the funtion in Matlab) what you will get is a 3 Dimensional Matrix. Time, Frequency and Amplitude on the 3 axis's. So now if you basically subtract the amplitudes keeping the time and Freq as reference , this will give you a good idea of how the trend is . – Chris Thaliyath Aug 13 '15 at 5:53
• There are some functions that you can use to plot a graph – Chris Thaliyath Aug 13 '15 at 10:01

I would say skip MATLAB and learn more about the published frequency responses by looking up your mics here: http://recordinghacks.com/microphones. There are hundreds of mic models with responses as such:

I would probably proceed as follows:

1. Calculate the power spectrum of both mics:

PSD = ((fftshift((((fft(Signal,numel(Signal)).*conj(fft(Signal,numel(Signal)))))))/(numel(Signal)/2)*dt));

2. If both signal have been recorded at exactly same time stamps, you should only subtract the amplitudes of both spectra to figure out how the behavior of the two mics differs.

Delta = abs(PSD2 - PSD1);

• So what is dt in this instance? And delta will obviously give me the difference in magnitude between the signals, but can I simply plot PSD1 and PSD2 on the same axis to also show frequency response, except the y-axis will show magnitude in watts not in dB? – n64playa Aug 13 '15 at 23:56

You want to find the transfer function of a microphone. This is a hard thing without some prerequisities. You'll need an anechoic or hemi-anechoic chamber. A flat spectrum excitation source. Don't know if your source is relatively flat? You are out of luck. You need to average also for a smoother response. The command you're looking for in MATLAB is freqz(). Go with the published response when you don't have these things at hand.