Different Bode Plots from Same Function

14 views (last 30 days)
Pri N
Pri N on 16 Apr 2023
Commented: Paul on 16 Apr 2023
Hello there,
I am quite confused as to why there are two bode plots being produced for this function. In the code, estimated_ntf4 has an extra pole and zero in the numerator and denominator while estimated_ntf3 does not, but they are essentially the same function. These two lines produce drastically different Bode Plots despite being the same function. Is this an issue with the bode plot function with Matlab?
diff = tf([1 -1], [1 0], 1);
diff.Variable = 'z^-1';
lf.num = tf([.28125 .6875 .03125 0], [1 0 0 0 0], 1);
lf.den = tf([1 -2 1], [1 0 0],1);
lf.num.Variable = 'z^-1';
lf.den.Variable = 'z^-1';
lf.tf = (lf.num)/(lf.den);
estimated_ntf3 = (diff)^2/(diff+lf.num); % Produces CORRECT bode plot
estimated_ntf4 = (diff*lf.den)/(lf.den+diff*lf.num); % Produces WRONG bode plot
figure; bode(estimated_ntf3)
figure; bode(estimated_ntf4)

Answers (1)

Sam Chak
Sam Chak on 16 Apr 2023
It seems that they are not exactly the same from the mathematical perspective.
format long g
estimated_ntf3 = (diff)^2/(diff+lf.num) % Produces CORRECT bode plot
estimated_ntf3 = 1 - 2 z^-1 + z^-2 -------------------------------------------- 1 - 0.7188 z^-1 + 0.6875 z^-2 + 0.03125 z^-3 Sample time: 1 seconds Discrete-time transfer function.
estimated_ntf4 = (diff*lf.den)/(lf.den+diff*lf.num) % Produces WRONG bode plot
estimated_ntf4 = 1 - 3 z^-1 + 3 z^-2 - z^-3 -------------------------------------------------------- 1 - 1.719 z^-1 + 1.406 z^-2 - 0.6562 z^-3 - 0.03125 z^-4 Sample time: 1 seconds Discrete-time transfer function.
z3 = zero(estimated_ntf3)
z3 = 3×1
0 1 1
p3 = pole(estimated_ntf3)
p3 =
0.381059741972577 + 0.758515788742094i 0.381059741972577 - 0.758515788742094i -0.0433694839451542 + 0i
z4 = zero(estimated_ntf4)
z4 =
0 + 0i 1.00000657194364 + 0i 0.999996714028179 + 5.69145454681503e-06i 0.999996714028179 - 5.69145454681503e-06i
p4 = pole(estimated_ntf4)
p4 =
0.999999999999999 + 0i 0.381059741972577 + 0.758515788742095i 0.381059741972577 - 0.758515788742095i -0.0433694839451543 + 0i

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!