ECG-Kit 1.0

File: <base>/common/design_downsample_filter.m (1,047 bytes)
%% (Internal) Design a filter to downsample signals prior printing to a report
%   
%   b = design_downsample_filter( downsample_factor )
% 
% Arguments:
% 
%      + downsample_factor: times to downsample signal
% 
% Output:
% 
%      + b: filter coefficients
% 
% Example:
% 
% Author: Mariano Llamedo Soria llamedom@electron.frba.utn.edu.ar
% Version: 0.1 beta
% Last update: 14/5/2014
% Birthdate  : 21/4/2015
% Copyright 2008-2015
% 
function b = design_downsample_filter( downsample_factor )
% MATLAB Code
% Generated by MATLAB(R) 8.2 and the Signal Processing Toolbox 6.20.
% Generated on: 23-Jun-2014 10:45:52

% FIR least-squares Lowpass filter designed using the FIRLS function.

% All frequency values are normalized to 1.

N     = 60;   % Order
Fpass = 1/downsample_factor;  % Passband Frequency
Fstop = min(1, Fpass + 0.1);  % Stopband Frequency
Wpass = 1;    % Passband Weight
Wstop = 100;  % Stopband Weight

% Calculate the coefficients using the FIRLS function.
b  = firls(N, [0 Fpass Fstop 1], [1 1 0 0], [Wpass Wstop]);

% [EOF]