Code covered by the BSD License

# Explore Experimental Data

### Alexander Ludwig Klein (view profile)

17 Mar 2012 (Updated )

The tool makes some of MATLAB's plotting and analysing functions available by a GUI

dataFilterStandard(x, y, Fc)
```function yfilt = dataFilterStandard(x, y, Fc)
% dataFilterStandard  Very simple lowpass filter
%-------------------------------------------------------------------------%
% Usage:
%   yfilt = dataFilterStandard(x,y,Fc)
%
% Input:
%    x, y     	signal that will be filtered (can be arrays of column vectors)
%    Fc         frequency of cheby2 lowpass filter in Hz or relative for Fc < 1
%
% Output:
%    yfilt    	filtered signal
%
% Requires:
%    filtfilthd
%
% Implementation Notes:
%
%-------------------------------------------------------------------------%
%   \$Revision: 0.2.0 \$  \$Date: 2012/03/16 20:33:00 \$
%-------------------------------------------------------------------------%

% Test input
if ~(nargin == 3)
help(mfilename);
error(sprintf('AlexanderKlein:%s',mfilename),'Wrong number of input arguments');
elseif ~isnumeric(x) || ~isnumeric(y) || ~(isnumeric(Fc) && isscalar(Fc))
error(sprintf('AlexanderKlein:%s',mfilename),'Wrong type of input arguments');
end

% call recursively if input consist of arrays
if ~isvector(y)
numSignal = size(y,2);
yfilt = y;
if isequal(size(x), size(y))
% different x for all signals
for i = 1:numSignal
yfilt(:,i) = dataFilterStandard(x(:,i), y(:,i), Fc);
end
else
% same x for all signals
for i = 1:numSignal
yfilt(:,i) = dataFilterStandard(x, y(:,i), Fc);
end
end
else
% Set options for the filter
Ts    = max(x) - min(x);
Fs    = (length(x)-1)/Ts;
% transform to absolute value or return unfiltered data
if Fc < 1
Fc = Fc*Fs;
elseif abs(Fc-1) <= 100 * eps
yfilt = y;
return
end
if Fc > Fs
warning(sprintf('AlexanderKlein:%s',mfilename),'Filter frequencey greater than sample rate ... doing nothing');
yfilt = y;
else
yfilt = filter(Fc/Fs, [1 Fc/Fs-1], y);
end
end
end
```