c2d Tustin not matching analytical method
Show older comments
I have a second order lowpass filter. Discrete transter function using c2d with tustin method does not match the analytical solution (see the code below with bode comparison). Analytical solution was obtained by subing s = 2/Ts * (z-1)/(z+1) in continuous transfer function which is apparantly consistent with Matlab c2d tsting option with the difference that the Matlab code is first converting TF to PZK and then fomulating c2d (see reference folders below) which is not an exact match to my fomulation but I did not expect this big of a difference. Thoughts appreciated.
/Applications/MATLAB_R2024b.app/toolbox/shared/controllib/engine/+ltipack/@tfdata/c2d.m % ltipack.tfdata method
/Applications/MATLAB_R2024b.app/toolbox/shared/controllib/engine/+ltipack/@zpkdata/c2d.m % ltipack.zpkdata method
%% Filter Specs
Ts = 0.01;
zeta = 1;
wn_rps = 30 *2*pi;
%% C2D (tustin)
s = tf('s');
tf_cont = wn_rps^2 / (s^2 + 2*zeta*wn_rps*s + wn_rps^2);
tf_disc = c2d(tf_cont, Ts, 'Method','tustin');
%% Analytical (tustin)
% s = 2/Ts * (z-1)/(z+1)
K = 2/Ts;
num = wn_rps^2 * [1 2 1];
den = [ K^2 + 2*zeta*wn_rps*K + wn_rps^2, ...
-2*K^2 + 2*wn_rps^2, ...
K^2 - 2*zeta*wn_rps*K + wn_rps^2 ];
tf_disc_analytical = tf(num, den, Ts);
%% Plot
figure, bode(tf_disc), hold on, bode(tf_disc_analytical)
Accepted Answer
More Answers (0)
Categories
Find more on Switches and Breakers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!