title: Matlab FIR filter maximum absolute error
body: <p>How can I determine the maximum absolute error (stopband and passband maximum ripple) for my filter?</p>
  
  <pre><code>% frequencies and amplitudes
  f = [0.0 0.45 0.55 1.0];
  a = [1.0 1.0 0.0 0.0];
  % Parks-McCellan optimal FIR filter with N+1 (11) coefficients
  [b, err, res] = firpm(10,f,a);
  % impulse response
  subplot(2,3,1);
  stem(b);
  title('Impulse response');
  
  % frequency response of filter
  [h,w] = freqz(b,256);
  % magnitude of frequency response
  subplot(2,3,2);
  plot(abs(h));
  title('Magnitude response')
  % phase of frequency response
  subplot(2,3,3);
  plot(angle(h));
  title('Phase response')
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/zho8L.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zho8L.png" alt="enter image description here"></a></p>