Linewidth and precision of ezplot
how is possible to deter开发者_开发知识库mine "linewidth" and "precision" in ezplot?
from "precision", i mean that if in [1 2] interval ezplot is very pale in some locations or discontinues too, when using interval[1.5 2] to ezplot, discontinuity is removed and line is continues.
I'm a little unclear what you mean by "precision". I think maybe you want to know either the number of plot points or the spacing between plot points. You can't adjust the number of points EZPLOT displays (you would have to evaluate the function and plot it yourself to do that), but you can find out how many points there are and the spacing between them. Let's say you make this call to EZPLOT:
h = ezplot(fun,[minValue maxValue]);
This will plot fun(x)
over the domain minValue < x < maxValue
. If you don't specify a domain, EZPLOT will use the default [-2*pi 2*pi]
. EZPLOT returns a handle(s) to the line objects that are plotted (h
in the above code). You can access the XData property of the first line object (if there is more than one line) by doing the following:
xData = get(h(1),'XData');
You can then find the number of points the line has:
nPoints = numel(xData);
and also the average spacing between points (what you may be referring to as "precision"):
delta = (max(xData)-min(xData))/(nPoints-1);
Also, you can change the LineWidth property of the lines with the following:
set(h,'LineWidth',2); %# Sets the line width to 2
If you add this to ezplot, specifying the domain as a vector it works.
ezplot(curve,[0:0.001:1])
精彩评论