%% Parks-McClellan Order of Lowpass Filter
% Design a lowpass filter with a 1500 Hz passband cutoff frequency and 2000 Hz stopband cutoff frequency. Specify a sampling frequency of 8000 Hz. Require a maximum stopband amplitude of 0.1 and a maximum passband error (ripple) of 0.01.

[n,fo,ao,w] = firpmord([1500 2000],[1 0],[0.01 0.1],8000);
b = firpm(n,fo,ao,w);

%
% Obtain an equivalent result by having firpmord generate a cell array. Visualize the frequency response of the filter.

c = firpmord([1500 2000],[1 0],[0.01 0.1],8000,'cell');
B = firpm(c{:});
freqz(B,1,1024,8000)

% Copyright 2015 The MathWorks, Inc.