
function [a,b] = hlfilter(b0,b2,highpass)

% use: function [a,b] = hlfilter(b0,b2,highpass)
% makes two 3-tab filters with the same amplitude spectrum, but with a
% different fase-spectrum. The first (a) has a lineair phase
% the other not, except when b0 = b2.
% Choose b0 and b2 with the same sign.
% highpass is a binary variable: if 1, compute high pass filter
%                                if 0, compute low pass filter
% 
% See linfase.m for a test example.
%


b1 = 2* sqrt(b0*b2);
a0 = sqrt(b0*b2);
a1 = b0+b2;

b1 = (1-2*highpass) * sign(b0) * b1;
a1 = a1 * sign(a1) * sign(b1) * sign(b0);
% IN FACT:
% a1 = a1 * sign(a1) * sign(b1) * sign(b0) * sign(a0);  WITH a0 > 0

a = [a0 a1 a0];
b = [b0 b1 b2];
