Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6186807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:57:07+00:00 2026-05-24T01:57:07+00:00

In some code I am writing, sometimes I get ticks values like this Clear[z];

  • 0

In some code I am writing, sometimes I get ticks values like this

Clear[z];
hz = z/(z^2 - 0.6 z + 0.18);
tf = TransferFunctionModel[hz, z, SamplingPeriod -> 1];
p = BodePlot[tf, {0.01, 2 Pi},
    Frame -> False, PlotLayout -> "List", 
    ScalingFunctions -> {{"Linear", "Absolute"}, {"Linear", "Degree"}}][[1]];
Show[p]

enter image description here

and this makes it hard to format the plot to account for this extra space. Now, I set the image padding very large to have enough space for this extra value and it is wasted space.

btw, This problem only affects the y-values in my case.

I will show what I tried to solve this. But I am not happy with either method I have tried, and wanted to ask if there is a simpler way to solve this problem

This is what I tried to solve the problem

1) Use Ticks->fun, but this is not working well, since it is hard to get the ticks formatted right, since the Bode plot y-values can change in units depending on options supplied, from dB to Absolute to Log10 to Linear and having to account for all of these and get the ticks right will not work.

Clear[z];
fun[min_, max_] := 
 Module[{}, 
  Join[Table[i, {i, Ceiling[min], Floor[max]}], 
   Table[j, {j, Round[min], Round[max - 1], 1}]]]

hz = z/(z^2 + 0.5);
tf = TransferFunctionModel[hz, z, SamplingPeriod -> 1];
p = BodePlot[tf, {0.01, 2 Pi}, Frame -> False, PlotLayout -> "List", 
    ScalingFunctions -> {{"Linear", "Absolute"}, {"Linear","Degree"}}, 
    Ticks -> fun][[1]];
Show[p]

enter image description here

second solution:

Make the plot first, grab the ticks, use NumberForm on them to format the y-values, and then make the plot with the new tick values:

Clear[z];
hz = z/(z^2 - 0.6 z + 0.18);
tf = TransferFunctionModel[hz, z, SamplingPeriod -> 1];
p = BodePlot[tf, {0.01, 2 Pi}, Frame -> False, PlotLayout -> "List", 
    ScalingFunctions -> {{"Linear", "Absolute"}, {"Linear", "Degree"}}][[1]];
ticks = Ticks /. AbsoluteOptions[p, Ticks];

ticks[[2, All, 1 ;; 2]] = 
  If[NumericQ[#[[2]]], {#[[1]], NumberForm[#[[2]], 3]}, #] & /@ 
   ticks[[2, All, 1 ;; 2]];

BodePlot[tf, {0.01, 2 Pi}, Frame -> False, PlotLayout -> "List", 
  ScalingFunctions -> {{"Linear", "Absolute"}, {"Linear", "Degree"}}, 
  Ticks -> {ticks, Automatic}][[1]]

enter image description here

The above method works, but it is slow, since I need to make BodePlot 2 times, and I find BodePlot to be a little slow than normal plots, so I’d rather not have to do the above unless there is no other simpler solution.

Does any one see a simpler solution to this problem, may be one of them expert tricks?

thanks

Update 1:

I’ve used FindDivision[] given in the answer below like this to obtain the plot without the problem:

BodePlot[tf, {0.01, 2 Pi}, Frame -> False, PlotLayout -> "List", 
  Ticks -> {{FindDivisions[{0, 10}, 10], N@FindDivisions[{0, 2}, 10]},Automatic}, 
  ScalingFunctions -> {{"Linear", "Absolute"}, {"Linear", "Degree"}}][[1]]

enter image description here

But this does not really help me in this case, as I do not know what divisions to do before hand unless I do the computation of the transfer function values over the range of the frequencies to find the minimum and the maximum, which ends up doing the whole computation twice, which I am trying to avoid.

FindDivisions would work nice if one knows before hand the min/max of the plot range.

Update 8/13/2001

I got reply from WRI on this. Part of the response:

Close Mathematica. Hold Control and Shift buttons while launching
 Mathematica. Keep holding the buttons down till Mathematica is fully up
 (the welcome screen shows up.)

 Try your plot again. How does this look ?

After following the above, the problem is fixed! The plot now do not show the problem shown at the top of this post any more.

I am not sure what caused the preferences files problem, but at least now, if a new problem shows up, the above trick will be something I will try first.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T01:57:07+00:00Added an answer on May 24, 2026 at 1:57 am

    Errrr ….

    In Mma 8 :

    Clear[z];
    hz = z/(z^2 - 0.6 z + 0.18);
    tf = TransferFunctionModel[hz, z, SamplingPeriod -> 1];
    p = BodePlot[tf, {0.01, 2 Pi}, Frame -> False, PlotLayout -> "List", 
        ScalingFunctions -> {{"Linear", "Absolute"}, {"Linear", "Degree"}}][[1]];
    Show[p]
    

    enter image description here

    In Mma 7 you can use FindDivisions[]:

    p = BodePlot[tf, {0.01, 2 Pi}, 
        Frame -> False, PlotLayout -> "List", 
        Ticks -> {Automatic, FindDivisions[{0, 10}, {11, 10, 2}]}, 
        ScalingFunctions -> {{"Linear", "Absolute"}, {"Linear", "Degree"}}][[1]];
    Show[p]
    

    Edit

    You can use AbsoluteOptions[] to solve the problem in your Edit calculating the plot only once:

    p = BodePlot[tf, {0.01, 4 Pi}, 
                 Frame -> False, PlotLayout -> "List", 
                 ScalingFunctions -> {{"Linear", "Absolute"}, 
                                      {"Linear", "Degree"  }}];
    
    pr = (AbsoluteOptions[p, PlotRange] /. Rule[x_, y_] -> y);
    
    Show[First@p, 
         Ticks -> {N@FindDivisions[pr[[1, 1, 1]],10],
                   N@FindDivisions[pr[[1, 1, 2]],10]}
    ]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I was writing some code today that basically looks like this: string returnString
I'm writing some code that id like to be able to work with any
I'm writing some code that handles logging xml data and I would like to
Why does everyone tell me writing code like this is a bad practice? if
I am writing some code to determine whether a network domain is registered. For
I am writing some code and trying to speed it up using SIMD intrinsics
I'm writing some code for a class constructor which loops through all the properties
I'm writing some code in python and I'm having trouble when trying to retrieve
I was writing some code, and I notice a pattern in the exception handling
I'm writing some code where the UI thread need to communicate with the background

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.