Home > freetb4matlab > signal > fir1.m

# fir1

## PURPOSE

% error: b = fir1(n, w [, type] [, window] [, noscale])

## SYNOPSIS

function b = fir1(n, w, varargin)

## DESCRIPTION

```% error: b = fir1(n, w [, type] [, window] [, noscale])
%
% Produce an order n FIR filter with the given frequency cutoff,
% returning the n+1 filter coefficients in b.
%
% n: order of the filter (1 less than the length of the filter)
% w: band edges
%    strictly increasing vector in range [0, 1]
%    singleton for highpass or lowpass, vector pair for bandpass or
%    bandstop, or vector for alternating pass/stop filter.
% type: choose between pass and stop bands
%    'high' for highpass filter, cutoff at w
%    'stop' for bandstop filter, edges at w = [lo, hi]
%    'DC-0' for bandstop as first band of multiband filter
%    'DC-1' for bandpass as first band of multiband filter
% window: smoothing window
%    defaults to hamming(n+1) row vector
%    returned filter is the same shape as the smoothing window
% noscale: choose whether to normalize or not
%    'scale': set the magnitude of the center of the first passband to 1
%    'noscale': don't normalize
%
% To apply the filter, use the return vector b:
%       y=filter(b,1,x);
%
% Examples:
%   freqz(fir1(40,0.3));
%   freqz(fir1(15,[0.2, 0.5], 'stop'));  % note the zero-crossing at 0.1
%   freqz(fir1(15,[0.2, 0.5], 'stop', 'noscale'));```

## CROSS-REFERENCE INFORMATION

This function calls:
• fir2 % error: b = fir2(n, f, m [, grid_n [, ramp_n]] [, window])
• window % Create a @var{n}-point windowing from the function @var{f}. The
This function is called by:
• decimate % error: y = decimate(x, q [, n] [, ftype])
• interp % error: y = interp(x, q [, n [, Wc]])

Generated on Sat 16-May-2009 00:04:49 by m2html © 2003