How to measure the frequency response of an acoustic filter by input and output signals I am trying to measure the frequency response of acoustic filter. I sample the sound before propagation in the filter and after by 2 different mics. And now I am trying to find the system (the acoustic path) frequency response.

Using matlab how can I do it?


I tried the identification app but the result is not so reliable and fails if the signal is changed.
I tried $\displaystyle\rm H=\frac{\lvert FFT(output)\rvert}{\lvert FFT(input)\rvert}$ but the result is bad too.


UPDATE: After running this code:

[y, Ss] = audioread('4.wav');

h = fir1(30,0.2,rectwin(31));
y_f = filter(h,1,y);

[Txy,f] = tfestimate(y,y_f);    
figure;
plot(f,mag2db(abs(Txy)))


I am getting: 

What I doing wrong?
tfestimate is a good approach. But it seems you're using the wrong kind of input to test the filter. If your input signal only contains lower frequencies tfestimate has not enough information to compute the transfer for higher frequencies. It's sort of a division by zero situation, then.