代码如下:
x=0:10;
y=0:10;
for i=1:11
plot([x(i),x(i)],[0,10],'--');
hold on;
plot([0,10],[y(i),y(i)],'--');
hold on;
end;
x1=zeros(1,10);
y1=zeros(1,10);
for i=1:10
x1(i)=x(i)+0.5;
y1(i)=y(i)+0.5;
end;
for i=1:10
plot(0,y1(i),'k.');
hold on;
plot(10,y1(i),'k.');
hold on;
plot(x1(i),0,'k.');
hold on;
plot(x1(i),10,'k.')
hold on
for j=1:10
plot(x1(i),y1(j),'k.');
hold on;
end;
end;
结果如下: