I was just curious as to the differences between the two order filters?
How I created these discrete filters for references
Designed in Continuous first then converted into Discrete
Using Tustin's method as I just want to convert the plant from continuous to discrete
Fc = 20kHZ
Used Prep warping nyquist frequency = 20kHZ (Sampling at Ts = 0.000025/40kHz)
Filter 1: 2nd Order Butterworth filter Analog
Filter 1A: 2nd Order Butterworth Filter Discrete
Filter 2: 1st Order RC Filter Discrete
As you can see in Filter 1A I was shocked to see that "Brick-wall" response and was curious to see what if I used a lower order filter.
In Filter 2 you can see a similar result. The only difference I can tell is that magnitude (dB). The 1st Order filter has a flatter pass band then the 2nd Order Butterworth Filter.
Is there any advantage in using a higher order filter when it comes to discrete? Why in discrete the "Brick-Wall" response is much more apparent now when its only a 2nd Order.
Let me know if I even approached this correctly has I haven't dont discrete in a long time, so I wouldn't be surprise if something went wrong.
Bonus question, why when I try to do a step response for both filters I get this:
Another question that came to mind: Could we use the Sampling time to essentially change the Cut off frequency then?
EDIT: Looks like my Sampling times are wrong no idea what I am doing anymore. How do you know which Sampling Time is suitable for you? Or is that the trade off sacrifice how close it looks to the continuous for sampling times
Code:
%% -- Low Pass Filter (LPF) -- %%
R1 = 15000;
R2 = 9100;
C1 = 0.001*10^-6;
C2 = 470*10^-12;
LPF_A = ((1)/(C2*R1*s + C2*R2*s + C1*C2*R1*R2*s^2 + 1));
opt = c2dOptions('Method','tustin','PrewarpFrequency',125663.706);
LPF_D = c2d(LPF_A,0.000025,opt);