Just playing around with the 'c2d' command from matlab and trying to convert a continuous 2nd - order lowpass Butterworth function to a digital one which has the specs of Fc = 20e3Hz and Fs = 44.410e3Hz.
When I apply the pre-warping frequency parameter of 20e3Hz, it doesn't close to mimicking the continuous function.
Is there a reason why this is occurring? Does the prewarping have a limitation of how much it can "pre-warp" or am I doing something wrong? Maybe that's the intended output?
Legends:
- LP = Continuous TF
- LP_D = Discrete TF
Code:
s = tf('s');
LP = 15587249629.803/(s^2+176556.77655678*s+15587249629.803);
LP_D = c2d(LP,1/44.410e3,['Method','tustin','prewarpFrequency',125663.706]);
UPDATE: With a higher FS = 96e3Hz from 44.410e3Hz with no pre warping:
UPDATE2: Comparing with and without prewarping on two different Fs (44.410kHz and 96kHz) using a 3rd order Butterworth filter lowpass
Cutoff frequencies:
- LP = 1.25e5 rad/s
- LP_D_44kHz = 6.70e4 rad/s
- LP_D_96kHz = 1.10e5 rad/s
With pre-warping:
Cutoff frequencies:
- LP = 1.25e5 rad/s
- LP_D_44kHz = 8.59e4 rad/s
- LP_D_96kHz = 1.13e5 rad/s
UPDATE 3: Doing some research I might have an idea. Just a gut feeling.
I found 2 resources that converted an analog Butterworth into a discrete one using the Tustin method with prewarping and it worked for them.
I noticed they created the Butterworth filter completely different from the way I did it. I made mine based on the Sallen-Key configuration and just found the transfer function, could that be it? For some reason the Sallen-Key way doesn,'t like the prewarping?
I also noticed when using a notch filter with the same sampling frequency (44.410kHz) and prewarping it works perfectly. Why when doing low pass filters it doesn't like it that much?
UPDATE 4: Could be the warping is just to nonlinear for it?
tan()
, and that's the effect you're seeing here. Also, when replying to someone, use@<tab>
to select the name, otherwise the other person might not get noticed. \$\endgroup\$s
, to a strongly nonlinear domain,z
. \$\endgroup\$fp
= passband (corner) frequency andf0
= sampling frequency. \$\endgroup\$