Matlab 版 (精华区)
发信人: zjliu (秋天的萝卜), 信区: Matlab
标 题: 想找出一个(平面)阵列(n*2)的边界 v1.0
发信站: BBS 哈工大紫丁香站 (Fri Apr 22 11:15:22 2005)
参考文献:hitzxz的贴子
目的:想找出一个阵列(n*2)的边界
想法:找出相同x值的点,再在其中找出最大最小y值。
方法:分割第一列元素(x),找出相同(x)的最大最小y值
load data_org.mat; % data_org的数据附在贴子后
X=data_org(:,1);
Y=data_org(:,2);
xt=unique(X);yt=unique(Y);
xd=[];yd=[];
for k=1:length(xt);
p=find(X==xt(k));
xd=[xd,xt(k)];
yd=[yd,max(Y(p))];
xd=[xd,xt(k)];
yd=[yd,min(Y(p))];
end
for k=1:length(yt);
p=find(Y==yt(k));
yd=[yd,yt(k)];
xd=[xd,max(X(p))];
yd=[yd,yt(k)];
xd=[xd,min(X(p))];
end
plot(X,Y,'o')
hold on
plot(xd,yd,'*')
================================================================
>> data_org(:,1:2)
ans =
68.0340 56.3040
68.4250 56.3040
68.8160 56.3040
69.2070 56.3040
69.5980 56.3040
67.2520 55.9130
67.6430 55.9130
68.0340 55.9130
68.4250 55.9130
68.8160 55.9130
69.2070 55.9130
69.5980 55.9130
69.9890 55.9130
70.3800 55.9130
70.7710 55.9130
71.1620 55.9130
66.8610 55.5220
67.2520 55.5220
67.6430 55.5220
68.0340 55.5220
68.4250 55.5220
68.8160 55.5220
69.2070 55.5220
69.5980 55.5220
69.9890 55.5220
70.3800 55.5220
70.7710 55.5220
71.1620 55.5220
66.4700 55.1310
66.8610 55.1310
67.2520 55.1310
67.6430 55.1310
68.0340 55.1310
68.4250 55.1310
68.8160 55.1310
69.2070 55.1310
69.5980 55.1310
69.9890 55.1310
70.3800 55.1310
70.7710 55.1310
71.1620 55.1310
66.4700 54.7400
66.8610 54.7400
67.2520 54.7400
67.6430 54.7400
68.0340 54.7400
68.4250 54.7400
68.8160 54.7400
69.2070 54.7400
69.5980 54.7400
69.9890 54.7400
70.3800 54.7400
70.7710 54.7400
66.0790 54.3490
66.4700 54.3490
66.8610 54.3490
67.2520 54.3490
67.6430 54.3490
68.0340 54.3490
68.4250 54.3490
68.8160 54.3490
69.2070 54.3490
69.5980 54.3490
69.9890 54.3490
70.3800 54.3490
66.0790 53.9580
66.4700 53.9580
66.8610 53.9580
67.2520 53.9580
67.6430 53.9580
68.0340 53.9580
68.4250 53.9580
68.8160 53.9580
69.2070 53.9580
69.5980 53.9580
69.9890 53.9580
66.0790 53.5670
66.4700 53.5670
66.8610 53.5670
67.2520 53.5670
67.6430 53.5670
68.0340 53.5670
68.4250 53.5670
68.8160 53.5670
69.2070 53.5670
69.5980 53.5670
66.0790 53.1760
66.4700 53.1760
66.8610 53.1760
67.2520 53.1760
67.6430 53.1760
68.0340 53.1760
68.4250 53.1760
68.8160 53.1760
69.2070 53.1760
66.0790 52.7850
66.4700 52.7850
66.8610 52.7850
67.2520 52.7850
67.6430 52.7850
68.0340 52.7850
68.4250 52.7850
68.8160 52.7850
69.2070 52.7850
66.0790 52.3940
66.4700 52.3940
66.8610 52.3940
67.2520 52.3940
67.6430 52.3940
68.0340 52.3940
68.4250 52.3940
68.8160 52.3940
66.0790 52.0030
66.4700 52.0030
66.8610 52.0030
67.2520 52.0030
67.6430 52.0030
68.0340 52.0030
68.4250 52.0030
68.8160 52.0030
66.8610 51.6120
67.2520 51.6120
67.6430 51.6120
68.0340 51.6120
68.4250 51.6120
66.8610 51.2210
67.2520 51.2210
67.6430 51.2210
68.0340 51.2210
67.2520 50.8300
67.6430 50.8300
68.0340 50.8300
--
我的友情测试更新了,欢迎测试!
有事找我可以到P_zjliu版给我留言,那里是我的地盘
╔═══════════════════╗
║★★★★★友谊第一 比赛第二★★★★★║
╚═══════════════════╝
※ 修改:·zjliu 于 Apr 22 15:43:58 修改本文·[FROM: 202.118.229.162]
※ 来源:·哈工大紫丁香 http://bbs.hit.edu.cn·[FROM: 202.118.229.*]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.872毫秒