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?

• What is your signal? Have you tried the wel established methods such as MLS, sweep-sine, etc?
– jojek
Aug 24 '16 at 10:06
• You often can test relatively easy test if your system is LTI by inputting a single frequency. If it is not LTI you should see different frequencies in the output. Also I assume you used the MATLAB function tfestimate, if so which window, how many windows, and how much overlap did you use? Aug 24 '16 at 12:33
• According to the design of the acoustic path , it intend to behave like a filter. desired like a BPF . taking this in consideration I think the system is LTI. but I will perform the test now. thanks. I used tfestimate but without windows only input and output. I am not an expert in matlab at all :) I am very basic user. can you please explain about the windows?
– Anna
Aug 25 '16 at 7:01
• fibonatic, I am trying the tfestimate function but I can not foind how to work with it. Do you have any materials?
– Anna
Sep 4 '16 at 9:52