I hope to design 1st order highpass filter from transfer function. In the example of 1st order lowpass filter, I first get the coefficients of numerator and denominator in the variable 'b' and 'a'. In case of first order filer,
b = 1/tau;
a = [1, 1/tau];
h = freqs(b, a, w) % LPF
[digital_b, digial_a] = bilinear(b, a, fs) % Analog to Digital transformation.
The order is like above. First, we obtain the coefficients of the transfer function and then make LPF by the 'freq' function in MATLAB. After that, I can convert the analog filter to a digital filter by using the 'bilinear' function.
However, in case of HPF, I cannot transform it using the 'bilinear' function. When I run the 'bilinear' function in MATLAB for 1st order HPF, it gives the following error
Numerator cannot be higher order than denominator.
I used the code below to make digital HPF.
b = [1, 1/tau];
a = 1;
h = freqs(b, a, w) % LPF
[digital_b, digial_a] = bilinear(b, a, fs) % Analog to Digital transformation.
What is the problem? and how should I design HPF on MATLAB?