function [ hd ] = create_filter_cheby( n, Wn, varargin)
%   hd = create_filter_cheby(n, Wn, ftype)
%
%          hd: filter object
%           n: order of Cheby type 2 filter
%          Wn: cutoff frequency, relative to nyquist rate
%       ftype: 'low' - generate lowpass filter (default)
%              'high' - generate highpass filter
%              'stop' - generate bandstop filter (with Wn: [W1 W2])

%	hd = struct('desc', '', 'type', '', 'b', [], 'a', []);

%	hd.type = 'chebyba';
%	hd.desc = 'A cheby2 BA Filter';

%	[b,a] = cheby2(n, 40, Wn, varargin{:});
%	hd.b = b;
%	hd.a = a;

	hd = struct('desc', '', 'type', '', 'sos', [], 'g', []);

	hd.type = 'chebysos';
	hd.desc = 'A cheby2 SOS Filter';

	[z, p, g] = cheby2(n, 60, Wn, varargin{:});

        [hd.sos, hd.g]  = zp2sos(z, p, g);

end
