呵呵,不好意思,忘了,经验不足,在此补过啦
theta=linspace(0,2*pi,50);
rad=1:1:11;
x=cos(theta)'*rad;
y=sin(theta)'*rad;
plot(x,y);
hold on
axis equal
for i=0:1:10 %循环算法画出有限元图
for j=1:1:i+1
plot([(i+1)*cos(j*pi/2/(i+2)),i*cos(j*pi/2/(i+1))],[(i+1)*sin(j*pi/2/(i+2)),i*sin(j*pi/2/(i+1))]); %画出第一象限中横向线
plot([(i+1)*cos(pi-j*pi/2/(i+2)),i*cos(pi-j*pi/2/(i+1))],[(i+1)*sin(pi-j*pi/2/(i+2)),i*sin(pi-j*pi/2/(i+1))]); %画出第二象限中横向线
plot([(i+1)*cos(pi+j*pi/2/(i+2)),i*cos(pi+j*pi/2/(i+1))],[(i+1)*sin(pi+j*pi/2/(i+2)),i*sin(pi+j*pi/2/(i+1))]); %画出第三象限中横向线
plot([(i+1)*cos(-j*pi/2/(i+2)),i*cos(-j*pi/2/(i+1))],[(i+1)*sin(-j*pi/2/(i+2)),i*sin(-j*pi/2/(i+1))]); %画出第四象限中横向线
plot([(i+1)*cos(pi/2-j*pi/2/(i+2)),i*cos(pi/2-j*pi/2/(i+1))],[(i+1)*sin(pi/2-j*pi/2/(i+2)),i*sin(pi/2-j*pi/2/(i+1))]); %画出第一象限中纵向线
plot([(i+1)*cos(pi/2+j*pi/2/(i+2)),i*cos(pi/2+j*pi/2/(i+1))],[(i+1)*sin(pi/2+j*pi/2/(i+2)),i*sin(pi/2+j*pi/2/(i+1))]); %画出第二象限中纵向线
plot([(i+1)*cos(3*pi/2-j*pi/2/(i+2)),i*cos(3*pi/2-j*pi/2/(i+1))],[(i+1)*sin(3*pi/2-j*pi/2/(i+2)),i*sin(3*pi/2-j*pi/2/(i+1))]); %画出第三象限中纵向线
plot([(i+1)*cos(3*pi/2+j*pi/2/(i+2)),i*cos(3*pi/2+j*pi/2/(i+1))],[(i+1)*sin(3*pi/2+j*pi/2/(i+2)),i*sin(3*pi/2+j*pi/2/(i+1))]); %画出第四象限中纵向线
hold on
end
end |