%==================================================================
%
%	GetHighLowFiltCoeff.m
%
%	Markus Junghoefer	[1995]
%   This software is protected by german copyright and international treaties.             
%   Copyright 2004 Markus Junghöfer & Peter Peyk. All Rights Reserved.                     
%                                                                                          
%   THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE        
%   NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO,    
%   WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE    
%   OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
%   TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT,       
%   INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE      
%   OR DOCUMENTATION.                                                                      
%
%
%	Function definition

	function [ch_LowPassFilt,LowB,LowA,ch_HighPassFilt,HighB,HighA,LowFreqsMat,HighFreqsMat] = ...
	GetHighLowFiltCoeff(SampRate,HighDefFreqsMat,HighDefRipMat,LowDefFreqsMat,LowDefRipMat,...
	ch_LowPassFilt,ch_HighPassFilt)

%=================================================================
if nargin<7; ch_HighPassFilt=[]; end;
if nargin<6; ch_LowPassFilt=[]; end;
if nargin<5; LowDefRipMat=[]; end;
if nargin<4; LowDefFreqsMat=[]; end;
if nargin<3; HighDefRipMat=[]; end;
if nargin<2; HighDefFreqsMat=[]; end;
if nargin<1; SampRate=[]; end;



[SampRate]=IfEmptyInputSpecVal(SampRate,[125 250],[250],['Please insert the sampling rate:']);

if isempty(HighDefRipMat); HighDefRipMat=[3 45]; end
if isempty(HighDefFreqsMat); HighDefFreqsMat=[SampRate 5 2]; end
if isempty(LowDefRipMat); LowDefRipMat=[3 45]; end
if isempty(LowDefFreqsMat); LowDefFreqsMat=[SampRate 40 50]; end

[ch_LowPassFilt]=IfEmptyInputBo(['Do you want to filter channels lowpass ?'],[],ch_LowPassFilt,1,1);
if ch_LowPassFilt
	global num den FreqsMat
	[num,den,FreqsMat,hFigure]=GetLowFiltCoeff('initialize',[],LowDefFreqsMat,LowDefRipMat);
	waitfor(hFigure);
	LowB=num;
	LowA=den;
	LowFreqsMat=FreqsMat;
else
	LowB=[];
	LowA=[];
	LowFreqsMat=[];
end
[ch_HighPassFilt]=IfEmptyInputBo(['Do you want to filter channels highpass ?'],[],ch_HighPassFilt,1,1);
if ch_HighPassFilt
	global num den FreqsMat
	[num,den,FreqsMat,hFigure]=GetHighFiltCoeff('initialize',[],HighDefFreqsMat,HighDefRipMat);
	waitfor(hFigure);
	HighB=num;
	HighA=den;
	HighFreqsMat=FreqsMat;
else
	HighB=[];
	HighA=[];
	HighFreqsMat=[];
end
return
