标题:怎么样把所有点连接起来?
只看楼主
kk9587a
Rank: 2
等 级:论坛游民
帖 子:33
专家分:54
注 册:2013-3-24
结帖率:100%
 问题点数:0 回复次数:1 
怎么样把所有点连接起来?
程序代码:
a=80;
r1=0.5*a;
r2=5.5*a;
lab=15*a;
lbc=2*pi*r1;
lcd=15*a;
lah=5.5*a;
lef=15.5*a;
lhg=15.5*a;
lge=pi*r2;
ldf=5.5*a;

m=76;
m1=23;
m2=30;
m3=23;
m4=29;
m5=18;
m6=29;
n=20;

dab=lab/m1;
dcd=lcd/m3;
dah=lah/n;
dhg=lhg/m4;
def=lef/m6;

x=ones(m+1,n+1);
y=ones(m+1,n+1);

%lab
x(1,1)=r1+lab;
y(1,1)=0;

j=1;
for i=2:m1+1
    x(i,j)=x(i-1,j)-dab;
    y(i,j)=y(1,1);
end

%lbc
j=1;
for i=m1+2:m1+m2+1
     x(i,j)=r1*cos(2*pi-(2*pi/m2*(i-(m1+1))));
     y(i,j)=r1*sin(2*pi-(2*pi/m2*(i-(m1+1))));
end

%lcd
j=1;
for i=m1+m2+2:m+1
    x(i,j)=x(i-1,j)+dcd;
    y(i,j)=y(1,1);
end

%lah
i=1;
for j=2:n+1
    x(i,j)=x(i,1);
    y(i,j)=y(i,j-1)-dah;
end

%ldf
i=m+1;
for j=2:n+1
    x(i,j)=x(i,1);
    y(i,j)=y(i,j-1)+dah;
end

%lgh
j=n+1;
for i=2:m4+1
    x(i,j)=x(i-1,j)-dhg;
    y(i,j)=-ldf;
end

%lge
j=n+1;
for i=m4+2:m4+m5+1
    x(i,j)=r2*cos(3*pi/2-pi/m5*(i-(m4+1)));
    y(i,j)=r2*sin(3*pi/2-pi/m5*(i-(m4+1)));
end

%lef
j=n+1;
for i=m4+m5+2:m+1
    x(i,j)=x(i-1,j)+def;
    y(i,j)=ldf;
end
for i=2:m
    for j=2:n
    x(i,j)=x(i,j-1)+(x(i,n+1)-x(i,1))/n;
    k=(y(i,n+1)-y(i,1))/(x(i,n+1)-x(i,1));
    y(i,j)=y(i,n+1)-k*(x(i,n+1)-x(i,j));
    end
end
plot(x,y,'.')
横纵都连起来,有高手么?
搜索更多相关主题的帖子: lcd 
2013-04-08 15:13
异路飞鹰
Rank: 1
等 级:新手上路
威 望:1
帖 子:3
专家分:0
注 册:2013-4-19
得分:0 
将最后一行的plot(x,y,'.')改为line(x,y)
2013-04-22 19:29



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-403321-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.408575 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved