Message Boards Message Boards

Mathematica Plot Step Interval

GROUPS:

I would like to go into mathematica’s plot step intervals so I can get more accurate result. enter image description here

enter image description here

I do not want to use ListLinePlot method to address the accuracy. Therefore, I would like to change the in build function of the plot by myself.

Thank you

POSTED BY: Sheng Dai
Answer
19 days ago

The option PlotPoints lets you choose how many points the adaptive algorithm starts with:

Plot[Sin[x], {x, 0, 2 Pi}, PlotPoints -> 201]

Other related options are MaxRecursion and MaxPlotPoints, that control after how many adaptive iteration, or how many total points, the algorithm will stop refining.

POSTED BY: Gianluca Gorni
Answer
19 days ago

The sampling of Plot is controlled by three option settings

PlotPoints -> npts
MaxRecursion -> mr  (* default  is 6 for Plot[]; max is 15 *)
Method -> {"Refinement" -> {"ControlValue" -> rad}}  (* in radians (was Method -> {"MaxBend" -> deg} in degrees) *)

PlotPoints -> npts determines the initial number npts of sampling points. The intervals about a sampling point are subdivided (in two) if the two adjacent line segments deviate from forming a straight line by an angle of more than the control value rad (in radians). This is done up to the MaxRecursion setting mr times. My own investigations show that it is not that simple, in that recursive subdivision sometimes continues past the limit defined by the control value rad. Also, it appears that in the recursive subdivision process, the intervals defined by the sample points are separated into two classes, those that have satisfied the control value and those under active recursive subdivision. Once an interval $I$ is marked "OK," it does not seem to ever be reconsidered for active subdivision, even if an adjacent interval is subdivided to the point that the angle formed with $I$ exceeds rad.

Generally, you want PlotPoints to be high enough that every peak or valley in the plot has at least one sampling point. You also want it high enough so that recursive subdivision is able to resolve the features of the graph (to your satisfaction) after at most MaxRecursion subdivisions. Usually, one does not need to change the control value rad for screen plots, but if more accurate plots are needed, it can be used to make the plot appear smoother.

POSTED BY: Michael Rogers
Answer
19 days ago

Group Abstract Group Abstract