create butterworth hpf without using butter command in matlab

To create a Butterworth high-pass filter without using the butter command in MATLAB, you can follow the below steps:

  1. Specify the filter order (n) and the cutoff frequency (Fc).
  2. Use the designfilt command to create a high-pass Butterworth filter.
  3. Use the fvtool command to visualize the filter's frequency response.

Here's an example code snippet:

main.m
% Define filter specifications
n = 4;      % Filter order
Fc = 100;   % Cutoff frequency (Hz)

% Create high-pass Butterworth filter
d = designfilt('highpassiir', 'FilterOrder', n, 'CutoffFrequency', Fc, 'DesignMethod', 'butter');

% Visualize filter frequency response
fvtool(d)
280 chars
10 lines

In this example, the designfilt command creates a fourth-order Butterworth high-pass filter with a cutoff frequency of 100 Hz. The resulting filter coefficients are stored in the d variable. The fvtool command is then used to visualize the filter's frequency response.

gistlibby LogSnag