EXAMP_OUTERMIDDLE - Outer and middle ear filters.

Program code:


% Sampling frequency to use. Must be higher than 20000 to show the full
% range of the data defining the filters.
fs=22050;

% Calculate the filters.
bout = headphonefilter(fs);
bmid = middleearfilter(fs);

% Half the filter length.
n2=(length(bout)-1)/2;

% x-values for plotting.
xplot=linspace(0,fs/2,n2);

figure(1);
% Manually calculate the frequency response
fout = 20*log10(abs(fft(ifftshift(bout))));
fout=fout(1:n2);

semiaudplot('x','erb',xplot,fout);
xlabel('Frequency in Hz (on erb scale)');
ylabel('Magnitude of filter in Db');
title('Frequency response of headphone+outer ear filter.');

figure(2)
% Manually calculate the frequency response
fmid = 20*log10(abs(fft(ifftshift(bmid))));
fmid=fmid(1:n2);

semiaudplot('x','erb',xplot,fmid);
xlabel('Frequency in Hz (on erb scale)');
ylabel('Magnitude of filter in Db');
title('Frequency response of middle ear filter.');