简体   繁体   English

Matlab连接图中的外部边界点

[英]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)

Thanks in advance. 提前致谢。 在此处输入图片说明

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM