MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   ezplot的线宽和精度 (https://www.labfans.com/bbs/showthread.php?t=23038)

poster 2019-12-10 20:30

ezplot的线宽和精度
 
如何确定ezplot中的“线宽”和“精度”?

从“精度”中,我的意思是,如果ezplot在[1 2]区间中在某些位置非常浅或不连续,则当使用interval [1.5 2]进行ezplot时,不连续性将被删除,并且线条将继续。



[B]回答:[/B]

我不清楚您所说的“精确”是什么意思。我想也许您想知道绘图点的数量或绘图点之间的间距。您无法[I]调整[/I] [URL="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/ezplot.html"]EZPLOT[/URL]显示的点数(您必须评估该函数并自己绘制才能执行此操作),但是您[I]可以[/I]找出有多少点以及它们之间的间距。假设您致电[URL="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/ezplot.html"]EZPLOT[/URL] :

h = ezplot(fun,[minValue maxValue]); 这将在域minValue < x < maxValue绘制fun(x) 。如果您未指定域,则[URL="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/ezplot.html"]EZPLOT[/URL]将使用默认的[-2*pi 2*pi] 。 [URL="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/ezplot.html"]EZPLOT[/URL]返回绘制的[URL="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/line.html"]线对象[/URL]的句柄(以上代码中的h )。通过执行以下操作,可以访问第一行对象的[URL="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/line_props.html#XData"][B]XData属性[/B][/URL] (如果有多行):

xData = get(h(1),'XData'); 然后,您可以找到线的点数:

nPoints = numel(xData); 以及点之间的平均间距(您可能将其称为“精度”):

delta = (max(xData)-min(xData))/(nPoints-1); 另外,您可以使用以下命令更改行的[URL="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/line_props.html#LineWidth"][B]LineWidth属性[/B][/URL] :

set(h,'LineWidth',2); %# Sets the line width to 2

[url=https://stackoverflow.com/questions/2020368]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 04:50

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.