Design a 6th-order lowpass Butterworth filter with a cutoff frequency of 300 Hz, which, for data sampled at 1000 Hz, corresponds to
rad/sample. Plot its magnitude and phase responses. Use it to filter a 1000-sample random signal.

Design a 6th-order Butterworth bandstop filter with normalized edge frequencies of
and
rad/sample. Plot its magnitude and phase responses. Use it to filter random data.

Design a 9th-order highpass Butterworth filter. Specify a cutoff frequency of 300 Hz, which, for data sampled at 1000 Hz, corresponds to
rad/sample. Plot the magnitude and phase responses. Convert the zeros, poles, and gain to second-order sections for use by `fvtool`

.

Design a 20th-order Butterworth bandpass filter with a lower cutoff frequency of 500 Hz and a higher cutoff frequency of 560 Hz. Specify a sample rate of 1500 Hz. Use the state-space representation. Design an identical filter using `designfilt`

.

Convert the state-space representation to second-order sections. Visualize the frequency responses using `fvtool`

.

Design a 5th-order analog Butterworth lowpass filter with a cutoff frequency of 2 GHz. Multiply by
to convert the frequency to radians per second. Compute the frequency response of the filter at 4096 points.

Design a 5th-order Chebyshev Type I filter with the same edge frequency and 3 dB of passband ripple. Compute its frequency response.

Design a 5th-order Chebyshev Type II filter with the same edge frequency and 30 dB of stopband attenuation. Compute its frequency response.

Design a 5th-order elliptic filter with the same edge frequency, 3 dB of passband ripple, and 30 dB of stopband attenuation. Compute its frequency response.

Plot the attenuation in decibels. Express the frequency in gigahertz. Compare the filters.

The Butterworth and Chebyshev Type II filters have flat passbands and wide transition bands. The Chebyshev Type I and elliptic filters roll off faster but have passband ripple. The frequency input to the Chebyshev Type II design function sets the beginning of the stopband rather than the end of the passband.