2

I am seeing another issue with BodePlot (new function in V 8.0). And I thought I ask here to see if someone can see something I am not seeing.

The normal way I know to extract options from an object such as a plot is to use AbsoluteOptions, like this:

p=Plot[Sin[x],{x,0,2Pi}];
AbsoluteOptions[p,AxesOrigin]

Which returned

{AxesOrigin -> {0., 0.}}

Trying to do the same with BodePlot, the only trick is that BodePlot default is to return Grid, so one must tell it to return plot image instead by the use of a new option called PlotLayout -> "List", which will return 2 plots in one list (the magnitude and phase). Then one can use AbsoluteOptions on anyone of the 2 plots, like in the above example.

In this example, I picked the first plot of the two, which is the magnitude, just for testing, same errors occur if the second plot (phase) is used:

Clear[z]
hz=z/(z^2-z+0.3);
tf=TransferFunctionModel[hz,z,SamplingPeriod->2]
p=BodePlot[tf,PlotLayout->"List"][[1]]

Everything so far is working well. The plot comes out fine.

Now comes the problem, I wanted to find value of an option, like I did with the Plot example at the top, so I typed

AbsoluteOptions[p,AxesOrigin]

And even though the correct answer is returned

{AxesOrigin -> {-2.803880122969847, -7.234556720270532}}

The problem is that many kernel errors are printed on the console at the same time:

Ticks::ticks: {At Line = 77, the input was:,AbsoluteOptions[p,AxesOrigin],
{{{-5.,-5.,{0.0125,0.},{GrayLevel[0.],AbsoluteThickness[0.25]}},<<33>>,{<<1>>}},
{<<1>>}}} is not a valid tick specification. >>

I tried the most minimal example above, and so, I have no idea why I get the above errors. I tried many other things, such as telling it to use Automatic for FrameTicks:

Clear[z]
hz=z/(z^2-z+0.3);
tf=TransferFunctionModel[hz,z,SamplingPeriod->2]
p=BodePlot[tf,PlotLayout->"List",FrameTicks->Automatic][[2]]
AbsoluteOptions[p,AxesOrigin]

But I can't get rid of these errors. I have a feeling BodePlot has a problem somewhere, but not sure, as I could be doing something wrong myself.

Any one know how to use AbsoluteOptions on BodePlot without getting these errors?

thanks

Update:

I've just discovered a workaround this problem. Trying different things, I found that one can use non-Frame layout of the BodePlot. The default was Frame->True. But when I tried Frame->False, now the problem went away:

Clear[z]
hz=z/(z^2-z+0.3);
tf=TransferFunctionModel[hz,z,SamplingPeriod->2]
p=BodePlot[tf,PlotLayout->"List",Frame->False][[1]]
AbsoluteOptions[p,Ticks]

No error, and the actual ticks are now returned. So, if someone wants to use BodePlot, may be using Frame->False is a choice. I actually did not like the original Frame layout anyway, and I like the standard plot more due to how the axes are shown in this case.

Mr.Wizard
  • 24,179
  • 5
  • 44
  • 125
Nasser
  • 12,849
  • 6
  • 52
  • 104

1 Answers1

2
In[96]:= Quiet[AbsoluteOptions[p, AxesOrigin]]

Out[96]= {AxesOrigin -> {-2.80388, -7.23456}}

But seriously, I think you should file a bug-report to support@wolfram.com

Sjoerd C. de Vries
  • 16,122
  • 3
  • 42
  • 94
  • Ok, but I asked here because I was not sure If I might be doing something wrong myself. I do not like to send bug report to WRI if I am not sure it is bug first. – Nasser Jul 27 '11 at 20:47
  • btw, it is more than just a Quiet[] issue, it also does not return the correct FrameTicks: AbsoluteOptions[p, FrameTicks] returned {FrameTicks -> {{}, {}, {}, {}}} which wrong. I also just send a bug report to WRI. – Nasser Jul 27 '11 at 20:55
  • @Nasser It looked like a clear bug to me: messages not directly to your action, and the action obviously legal. – Sjoerd C. de Vries Jul 27 '11 at 21:29