Why "Log10" (ScalingFunctions) is not working?

Hello,

https://reference.wolfram.com/language/ref/ScalingFunctions.html

1460Capture4.JPG

Why does the frequency axis not show as described in the documentation by using “Log10”? (ie 10^-3, 10^-2, 10^-1, 10^0, 10^1, 10^2, 10^3,…,10^6)

H = TransferFunctionModel[1/s, s]
Result1 = 
 BodePlot[H[I*2*\[Pi]*freq], {freq, 10^-3, 10^6}, 
  PlotRange -> {{-90, 60}}, PlotLayout -> "Magnitude", 
  ScalingFunctions -> {"Log10", "dB"}, 
  FrameLabel -> {HoldForm[Text[Frequency[Hz]]], 
    HoldForm[Text[Magnitude[dB]]]}, GridLines -> Automatic, 
  PlotStyle -> Thickness[0.005]]

Result2 = 
 BodePlot[H[I*2*\[Pi]*freq], {freq, 10^-3, 10^6}, 
  PlotRange -> {{-180, 0}}, PlotLayout -> "Phase", 
  ScalingFunctions -> {"Log10", "Degree"}, 
  FrameLabel -> {HoldForm[Text[Frequency[Hz]]], 
    HoldForm[Text[Phase[Degree]]]}, GridLines -> Automatic, 
  PlotStyle -> Thickness[0.005]]

Result3 = 
 BodePlot[H[I*2*\[Pi]*freq], {freq, 10^-3, 10^6}, 
  PlotRange -> {{-90, 60}, {-180, 0}}, 
  ScalingFunctions -> {{"Log10", "dB"}, {"Log10", "Degree"}}, 
  FrameLabel -> {{HoldForm[Text[Frequency[Hz]]], 
     HoldForm[Text[Magnitude[dB]]]}, {HoldForm[Text[Frequency[Hz]]], 
     HoldForm[Text[Phase[Degree]]]}}, GridLines -> Automatic, 
  PlotStyle -> Thickness[0.005]]

Mathematica 13.2 Notebook file attached.

Thank you.

Untitled-6.nb (125 KB)

Mathematica will choose tick labels according to some algorithm that it thinks makes the plot look good. In these cases, it decided that it should only label every other power of 10. But you can choose your own labels. You could add this option to your BodePlot:

FrameTicks -> {{Automatic, Automatic}, {Table[{10^i, Superscript[10, i]}, {i, -3, 5}], None}}

Hello Eric Rimbey,

I added. Result:

Mathematica 13.2 Notebook file attached.

Thank you.

Untitled-6.nb (122 KB)

It looks like you didn’t evaluate the expression defining H.

Yes. I evaluate now. Result:

Result1 = 
 BodePlot[H[I*2*\[Pi]*freq], {freq, 10^-3, 10^6}, 
  PlotRange -> {{-90, 60}}, PlotLayout -> "Magnitude", 
  ScalingFunctions -> {"Log10", "dB"}, 
  FrameLabel -> {HoldForm[Text[Frequency[Hz]]], 
    HoldForm[Text[Magnitude[dB]]]}, GridLines -> Automatic, 
  PlotStyle -> Thickness[0.005], 
  FrameTicks -> {{Automatic, 
     Automatic}, {Table[{10^i, Superscript[10, i]}, {i, -3, 5}], 
     None}}]

Result2 = 
 BodePlot[H[I*2*\[Pi]*freq], {freq, 10^-3, 10^6}, 
  PlotRange -> {{-180, 0}}, PlotLayout -> "Phase", 
  ScalingFunctions -> {"Log10", "Degree"}, 
  FrameLabel -> {HoldForm[Text[Frequency[Hz]]], 
    HoldForm[Text[Phase[Degree]]]}, GridLines -> Automatic, 
  PlotStyle -> Thickness[0.005], 
  FrameTicks -> {{Automatic, 
     Automatic}, {Table[{10^i, Superscript[10, i]}, {i, -3, 6}], 
     None}}]

Result3 = 
 BodePlot[H[I*2*\[Pi]*freq], {freq, 10^-3, 10^6}, 
  PlotRange -> {{-90, 60}, {-180, 0}}, 
  ScalingFunctions -> {{"Log10", "dB"}, {"Log10", "Degree"}}, 
  FrameLabel -> {{HoldForm[Text[Frequency[Hz]]], 
     HoldForm[Text[Magnitude[dB]]]}, {HoldForm[Text[Frequency[Hz]]], 
     HoldForm[Text[Phase[Degree]]]}}, GridLines -> Automatic, 
  PlotStyle -> Thickness[0.005], 
  FrameTicks -> {{Automatic, 
     Automatic}, {Table[{10^i, Superscript[10, i]}, {i, -3, 5}], 
     None}}]

Thank you.

Untitled-6.nb (103 KB)

Also, what does this code mean:

Superscript[10, i]

it doesn’t seem to represent or is equivalent to:

10^i

Does that code Superscript have any equivalent? or what is its equivalent?

Result1 = 
 BodePlot[H[I*2*\[Pi]*freq], {freq, 10^-3, 10^6}, 
  PlotRange -> {{-90, 60}}, PlotLayout -> "Magnitude", 
  ScalingFunctions -> {"Log10", "dB"}, 
  FrameLabel -> {HoldForm[Text[Frequency[Hz]]], 
    HoldForm[Text[Magnitude[dB]]]}, GridLines -> Automatic, 
  PlotStyle -> Thickness[0.005], 
  FrameTicks -> {{Automatic, 
     Automatic}, {Table[{10^i, 10^i}, {i, -3, 6}], None}}]

Hello Eric Rimbey,

I think I managed to do it for Result3 as well

Result3 = 
 BodePlot[H[I*2*\[Pi]*freq], {freq, 10^-3, 10^6}, 
  PlotRange -> {{-90, 60}, {-180, 0}}, 
  ScalingFunctions -> {{"Log10", "dB"}, {"Log10", "Degree"}}, 
  FrameLabel -> {{HoldForm[Text[Frequency[Hz]]], 
     HoldForm[Text[Magnitude[dB]]]}, {HoldForm[Text[Frequency[Hz]]], 
     HoldForm[Text[Phase[Degree]]]}}, GridLines -> Automatic, 
  FrameTicks -> {{{Automatic, 
      Automatic}, {Table[{10^i, Superscript[10, i]}, {i, -3, 6}], 
      None}}, {{Automatic, 
      Automatic}, {Table[{10^i, Superscript[10, i]}, {i, -3, 6}], 
      None}}}, PlotStyle -> Thickness[0.01]]

Now the question is related to that Superscript:

Result1 = 
 BodePlot[H[I*2*\[Pi]*freq], {freq, 10^-3, 10^6}, 
  PlotRange -> {{-90, 60}}, PlotLayout -> "Magnitude", 
  ScalingFunctions -> {"Log10", "dB"}, 
  FrameLabel -> {HoldForm[Text[Frequency[Hz]]], 
    HoldForm[Text[Magnitude[dB]]]}, GridLines -> Automatic, 
  PlotStyle -> Thickness[0.005], 
  FrameTicks -> {{Automatic, 
     Automatic}, {Table[{10^i, Superscript[10, i]}, {i, -3, 6}], 
     None}}]

Result4 = 
 BodePlot[H[I*2*\[Pi]*freq], {freq, 10^-3, 10^6}, 
  PlotRange -> {{-90, 60}}, PlotLayout -> "Magnitude", 
  ScalingFunctions -> {"Log10", "dB"}, 
  FrameLabel -> {HoldForm[Text[Frequency[Hz]]], 
    HoldForm[Text[Magnitude[dB]]]}, GridLines -> Automatic, 
  PlotStyle -> Thickness[0.005], 
  FrameTicks -> {{Automatic, 
     Automatic}, {Table[{10^i, 10^i}, {i, -3, 6}], None}}]

The only difference between Result1 and Result4 is only there in Table[…]
Looks like Superscript[10, i] wouldn’t equal 10^i…?
Although it seems that the 2 should have been equal, at least that’s what the documentation shows:
https://reference.wolfram.com/language/ref/Superscript.html

Mathematica 13.2 Notebook fille attached.

Thank you.

Untitled-6.nb (124 KB)

When defining ticks, the form {val, label} gives you the location for the tick as well as the appearance of the tick. The location will be val and the appearance will be label. Superscript is just a form that displays as superscript.

Eric Rimbey Ok. Thank you. Thanks for the support of the discussion on this topic. If something else will appear, I will post it.