Accuracy problem with BodePlot

Hoping to find a quick answer to a question of frequency response of multiple band-pass filters in closed loop, I opened up Mathematica,and entered the first set of equations as follows

ClearAll[bandPassOL]
bandPassOL[omega_, k_] := Module[{a, b, c, d},
a = {{0, -omega}, {omega, 0}};
b = {{omega*k}, {0}};
c = {{1, 0}, {0, 1}};
d = {{0}, {0}};
StateSpaceModel[{a, b, c, d}]](*Module*)
sys1CL = SystemsModelFeedbackConnect[bandPassOL[omega1,k1],{1,1}]


Plotting frequency response with BodePlot

BodePlot[sys1CL /. {k1 -> 0.1, omega1 -> 2 Pi 500}, {10^0, 10^5},
GridLines -> Automatic, PlotLayout -> "Magnitude"]


gave the expected result, as shown in the figure below

So far so good. I was ready for the next step. Connect two such resonators, sum in-phase outputs and feed them back to the input with negative feedback

sys2OL = SystemsModelParallelConnect[bandPassOL[omega1, k1],
bandPassOL[omega2, k2], All, None]
sys2CL = SystemsModelFeedbackConnect[sys2OL, {{1, 1}, {3, 1}}]


Resulting in expected state-space model. Now starts troubling part. Trying to plot frequency response of the sys2CL, the function BodePlot started acting strangely. I started first with the following parameters {omega1->2*Pi*50,k1->1,omega2->2*Pi*500,k2->1}, which, again, gave the expected result.

BodePlot[sys2CL /. {omega1->2*Pi*50,k1->1,omega2->2*Pi*500,k2->1}, {10^2, 10^4},
GridLines -> Automatic, PlotLayout -> "Magnitude"]


Now, I changed parameters to {omega1->2*Pi*50,k1->.5,omega2->2*Pi*500,k2->1} which yielded with the following plot

BodePlot[sys2CL /. {omega1->2*Pi*50,k1->0.5,omega2->2*Pi*500,k2->1}, {10^2, 10^4},
GridLines -> Automatic, PlotLayout -> "Magnitude"]


Which gave me complete garbage. I tried several more combinations and each time one (or both) of parameters k1 and k2 were less than 1, the result was wrong.

I tried increasing number of points and RecursionLimit but without improvement. Any suggestions are welcome.

Finally, I have "11.2.0 for Microsoft Windows (64-bit) (September 11, 2017)"

Update

I've installed MMA 10.2 (this was the only version besides 11.2 accessible to me) to try. I got the following result.

BodePlot[sys2CL /. {omega1->2*Pi*50,k1->0.5,omega2->2*Pi*500,k2->0.5}, {10^2, 10^4},
GridLines -> Automatic, PlotLayout -> "Magnitude"]


Basically, $$\alpha_1$$ and $$\beta_1$$ are expected to have gain of 0dB at the frequency $$\omega_1$$ (as in the second plot, for $$k1=k2=1$$). When I plot in Matlab I get the expected result.

Curiously enough, if I change parameters and plot the following

BodePlot[sys2CL /. {omega1->2*Pi*50,k1->0.05,omega2->2*Pi*500,k2->0.05}, {10^2, 10^4},
GridLines -> Automatic, PlotLayout -> "Magnitude"]


The following result is obtained

Expected Results

For $$\alpha_1$$ and $$\beta_1$$ 0dB gain is expected at frequency $$\omega_1$$ and infinite attenuation at angular frequency $$\omega_2$$. Similarly, for $$\alpha_2$$ and $$\beta_2$$ 0dB gain is expected at $$\omega_2$$ and infinite attenuation at $$\omega_1$$. Parameters $$k_1$$ and $$k_2$$ only affect selectivity of the transfer functions around the resonant points.

Clearly BodePlot is giving wrong result. I suspect it has to do something with number of initial points. However, I tried changing PlotPoints and MaxRecursion parameters without noticeable effect.

Update 2

It appears that the source of the problem is BodePlot function. The correct result is obtained if, instead of StateSpaceModel the TransferFunctionModel is submitted to the BodePlot function.

sys2CLTFM=TransferFunctionModel[sys2CL,s];
BodePlot[sys2CLTFM/. {omega1->2*Pi*50,k1->0.05,omega2->2*Pi*500,k2->0.05}, {10^2, 10^4},
GridLines -> Automatic, PlotLayout -> "Magnitude"]


Giving the expected result.

Should this be considered a bug?

• Hm. Interesting. Apparently, this problem does not arise in version 11.3 for macOS. Maybe it has already been fixed? – Henrik Schumacher Oct 1 '18 at 21:22
• I checked on Mathematica 11.01, 11.3. Everything works correctly. The author does not provide a line of code that, in his opinion, gives an erroneous plot. – Alex Trounev Oct 2 '18 at 2:26
• @AlexTrounev I updated the question. Thanks for pointing out missing elements. – ercegovac Oct 2 '18 at 8:19