Let's now try the Remez multiple exchange algorithm (``Parks-McClellan algorithm'') for optimal Chebyshev (equiripple) FIR filter design, and compare it to our window-method design.
Step 1: Design an optimal lowpass filter of the desired width (takes quite a while):
M = 257; % FIR filter length fs = 22050; % sampling rate (Hz) fn = fs/2; % Nyquist limit (Hz) f1 = 530; % lower passband limit (Hz) f2 = fn - f1; % upper passpand limit (see text, p. 136) hrm = firpm(M-1, [0,(f2-fs/4)/fn,0.5,1], ... [1,1,0,0], [1,10]);
Step 2: Modulate the impulse response to make it a single-sideband filter. I.e., right-shift by in the frequency domain (rotate the frequency response counterclockwise along the unit circle by 90 degrees):
hr = hrm .* j .^ [0:M-1];