% 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'));