MIDDLEEARFILTER - Middle ear filter.

Program code:

function b = middleearfilter(fs,order)

% Author: Morten Løve Jepsen, Peter L. Soendergaard


if nargin==1
  order = 512;    % desired FIR filter order
end;

stapes_data = [...
    50,	 48046.39731;...
    100, 24023.19865;...
    200, 12011.59933;...
    400,  6005.799663;...
    600, 3720.406871;...
    800,  2866.404385;...
    1000, 3363.247811;...
    1200, 4379.228921;...
    1400, 4804.639731;...
    1600, 5732.808769;...
    1800, 6228.236688;...
    2000, 7206.959596;...
    2200, 9172.494031;...
    2400, 9554.681282;...
    2600, 10779.64042;...
    2800, 12011.59933;...
    3000, 14013.53255;...
    3500, 16015.46577;...
    4000, 18017.39899;...
    4500, 23852.82136;...
    5000, 21020.29882;...
    5500, 22931.23508;...
    6000, 28027.06509;...
    6500, 28745.70779;...
    7000, 32098.9;...
    7500, 34504.4;...
    8000, 36909.9;...
    8500, 39315.4;...
    9000, 41720.9;...
    9500, 44126.4;...
    10000,46531.9;...
    ];

% We need to find inverse because original data is stapes impedance and we
% need stapes velocity.
stapes_data (:,2) = 1./stapes_data(:,2);

if nargin==0
  b = stapes_data;
else

  if fs<=20000
    % In this case, we need to cut the table because the sampling
    % frequency is too low to accomodate the full range.

    indx=find(stapes_data(:,1)