Problem with Bode Plot of cascaded discrete time systems

The bode plot of the cascaded connection of two discrete time systems is given an unexpected result. I'm using MATLAB 2017b. The unexpected Bode Plot obtained with MATLAB and the expected Bode Plot obtained with Wolfram Mathematica for the casacade system is illustrated below. What is the reason for the unexpected Bode Plot obtained with MATLAB? How can I get the same Bode Plot obtained with Wolfram Mathematica?
1-Considering the discrete time systems G1 and G2 whose bode plots are shown below:
2-The unexpected bode plot of the system G1*G2, which is the cascade connection of G1 and G2 is shown below:
3-The expected bode plot obtained with the software Wolfram Mathematica is shown below:
4-the script used in MATLAB is shown below:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Ts = 1/39960;
num1 = 1.0e+02.*[0.031539179206086,-0.218479792518950,0.648677356726311,-1.070054451616472,1.059168924735488,-0.629079503155372,0.207587755626987,-0.029359469003776];
den1 = [1.0,-6.878539169404124,20.274720364621878,-33.195141325571285,32.604147581404845,-19.210710652654448,6.287177056909766,-0.881653855287863];
G1 = filt(num1, den1, Ts);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
num2 = [0,0,0.030214737804111,-0.106047418049407,0.152721406591927,-0.106047418049407,0.030214737804111]
den2 = [1.0,-4.192774816029949,7.580364905504299,-7.484428436489121,4.192774816029949,-1.256799136009598,0.160862666994420]
G2 = filt(num2, den2, Ts);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
G1G2 = series(G1,G2)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure
bode(G1,'b')
hold
bode(G2,'r')
h = gcr;
h.AxesGrid.Xunits = 'Hz';
grid on;
xlim([10,40000])
h2 = findobj(gcf,'type','line');
set(h2,'linewidth',1);
h2 = findobj(gcf,'type','text');
set(h2,'FontSize',12);
legend('G1','G2')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure
bode(G1G2,'m')
h = gcr;
h.AxesGrid.Xunits = 'Hz';
grid on;
xlim([10,40000])
h2 = findobj(gcf,'type','line');
set(h2,'linewidth',1);
h2 = findobj(gcf,'type','text');
set(h2,'FontSize',12);
legend('G1*G2')

4 Comments

Hello! I have met the same problem. The bode plot of the series of two discrete transfer functions is very strange. In my case, one discrete transfer function has a resonant peak. I guess that it may be the problem caused by the resonant peak since the results of two ordinary discrete transfer functions without resonant peaks are correct. If you have an answer to this problem, it will be very kind of you to share it. My email is 2514842881@qq.com.
Sorry, unfortunately I didn't get any answer to this question.
Thanks anyway. I am trying to use the software Wolfram Mathematica instead as suggested by you~
Sorry to bother again. I have not used Mathematica before, and would please tell me which is the funcion for bode plot in Mathematica? Thank you.

Sign in to comment.

 Accepted Answer

I can't tell you why your result is so inaccurate; I suspect it has to do with numerical issues in how the CST develops the tf form of G1G2. However, I can say that as a general rule it's best to avoid the tf form and use either zpk or ss. In this case, you'll get the expected result if you form G1G2 as:
G1G2 = zpk(G1)*zpk(G2)

2 Comments

I agree that this problem is related to the numerical issue. G1G2 = zpk(G1)*zpk(G2) can provide the correct result. Thank you for this valuable suggestion~
Thank you very much for your suggestion, using G1G2 = zpk(G1)*zpk(G2) the expected Bode plot appeared.

Sign in to comment.

More Answers (1)

Hello, I have the same problem, but the solution here doesn't work. I have MATLAB 2021.
I have 3 times the same implementation: G1 = G2 = G3 = filt(num1,den1,1/fmod); [Ihave also tested with tf()]
fmod = 20e6;
index1= 256;
den1 = [1 -1];
num1= 2:0.0:index1-1;
num1(index1) = -1;
num1(1) = 1;
So the transfer function is:
1 - z^-256
----------
1 - z^-1
The bodeplot of each one is: bode(G1)
But when I plot the 3 of them at the same time bode(G1*G2*G3) I get
Best Regards,

2 Comments

fmod = 20e6;
index1= 256;
den1 = [1 -1];
num1= 2:0.0:index1-1;
num1(index1) = -1;
num1(1) = 1;
G1 = filt(num1,den1,1/fmod)
G2 = filt(num1,den1,1/fmod)
G3 = filt(num1,den1,1/fmod)
G1ZPK = zpk(G1)
G2ZPK = zpk(G2)
G3ZPK = zpk(G3)
G1G2G3 = G1 * G2 * G3
G1G2G3ZPK = G1ZPK * G1ZPK * G3ZPK
%--------------------------------------------------------------------------
figure
bode(G1G2G3,'b')
hold on
bode(G1G2G3ZPK,'r--')
%--------------------------------------------------------------------------
h = gcr; % Get the handle for the "plot object root"
h.AxesGrid.Xunits = 'Hz';
grid on; % or h.AxesGrid.Grid = "on"
xlim([1,1000000])
h2 = findobj(gcf,'type','line');
set(h2,'linewidth',1);
h2 = findobj(gcf,'type','text');
set(h2,'FontSize',14);
legend('G1G2G3(z)','G1G2G3ZPK(z)')
%--------------------------------------------------------------------------
It works. I think I have used another function by mistake. probably pzmap instead of zpk.
By bad. thanks for your help.

Sign in to comment.

Categories

Asked:

on 24 Jan 2018

Commented:

on 3 May 2022

Community Treasure Hunt

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

Start Hunting!