[英]Matlab connect outer boundary points in plot
Please find attached a footprint plot of a missile trajectory. 请在附件中找到导弹轨迹的足迹图。 I want to connect the most outer points of the plot, like this: http://nl.mathworks.com/help/matlab/ref/boundary.html .
我想连接该图的最外部点,例如: http : //nl.mathworks.com/help/matlab/ref/boundary.html 。 Problem is this boundary function has been implemented in matlab 2014. Unfortunatly, I have to deal with Matlab 2013a... How can I achieve the same plots as the newer boundary function?
问题在于此边界函数已在matlab 2014中实现。不幸的是,我必须处理Matlab 2013a ...我如何才能获得与较新边界函数相同的图? My plot-command is simply:
我的绘图命令很简单:
plot(x,y)
edit: I used the convhull command. 编辑:我使用了convhull命令。 According to the description it should do the job.
根据描述,它应该完成这项工作。 However, something is going wrong.
但是,出了点问题。 the code:
编码:
figure(4)
subplot(1,2,1);
plot(y_array,x_array,'b*');
k=convhull(y_array,x_array);
subplot(1,2,2);
plot(x(k),y(k),'r-')
The same error occcures when using: 使用时发生相同的错误:
DT=delaunayTriangulation(y_array',x_array');
[K,v]=convexHull(DT);
subplot(1,2,2);
plot(x(K),y(K),'r')
I would try using convhull
on it. 我会尝试在其上使用
convhull
。 From https://www.mathworks.com/help/matlab/ref/convhull.html , this is how you can plot the convex hull (if that's what you mean by 'outer points'): 在https://www.mathworks.com/help/matlab/ref/convhull.html中 ,这是绘制凸包的方式(如果这就是“外点”的意思):
xx = -1:.05:1;
yy = abs(sqrt(xx));
[x,y] = pol2cart(xx,yy);
k = convhull(x,y);
plot(x(k),y(k),'r-',x,y,'b*')
convhull
was introduced before R2006a, and so should work on your version. convhull
在R2006a之前引入,因此应该在您的版本上起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.