matlab 画圆_如何以很多点的已知坐标画圆MATLAB
在200*200中,画75个随机节点
clc clear ndot=75; %画100个点 xmin=0; %x轴起点坐标 xmax=200; %x轴终点坐标 ymin=0; ymax=200; xx=rand(ndot,1)*(xmax-xmin)+xmin; %随机产生100个节点 yy=rand(ndot,1)*(ymax-ymin)+ymin; plot(xx,yy,bo) %画图 axis([xmin,xmax,0,190]) %画出x轴y轴的范围 也可以改为axis([xmin,xmax,ymin,ymax]),改为这个后x,y轴的坐标范围都为0-100 legend(Member Node) %显示右上角的注释
要使圆可见,即使它们已被遮盖,您也可以使用具有透明度(alpha)的颜色。 矩形不支持透明度,因此必须使用patch功能。通过patch绘图并通过适当的属性指定颜色和透明度
clc
clear
ndot=75; %画100个点
xmin=0; %x轴起点坐标
xmax=200; %x轴终点坐标
ymin=0;
ymax=200;
xx=rand(ndot,1)*(xmax-xmin)+xmin; %随机产生100个节点
yy=rand(ndot,1)*(ymax-ymin)+ymin;
plot(xx,yy,bo) %画图
axis([xmin,xmax,0,190]) %画出x轴y轴的范围 也可以改为axis([xmin,xmax,ymin,ymax]),改为这个后x,y轴的坐标范围都为0-100
legend(Member Node) %显示右上角的注释
MinVal = -1;
MaxVal = 1;
nCircles = 75;
Dimension = 2;
Circles =[xx yy];
Radius = 15*ones(nCircles, 1);
cmap = hsv(nCircles); %// define colors. You could change `hsv` to `jet`, `cool`, ...
alpha = .5; %// define level of transparency
t = 0 : .1 : 2 * pi;
hold on;
for i = 1 : nCircles
x = Radius(i) * cos(t) + Circles(i,1);
y = Radius(i) * sin(t) + Circles(i,2);
patch(x, y, cmap(i,:), facealpha, alpha, edgecolor, none); %// plot filled circle with transparency
end
axis equal; %// same aspect ratio in both axes
grid on; clc clear ndot=75; %画100个点 xmin=0; %x轴起点坐标 xmax=200; %x轴终点坐标 ymin=0; ymax=200; xx=rand(ndot,1)*(xmax-xmin)+xmin; %随机产生100个节点 yy=rand(ndot,1)*(ymax-ymin)+ymin; plot(xx,yy,bo) %画图 axis([xmin,xmax,0,190]) %画出x轴y轴的范围 也可以改为axis([xmin,xmax,ymin,ymax]),改为这个后x,y轴的坐标范围都为0-100 legend(Member Node) %显示右上角的注释 MinVal = -1; MaxVal = 1; nCircles = 75; Dimension = 2; Circles =[xx yy]; Radius = 15*ones(nCircles, 1); cmap = hsv(nCircles); %// define colors. You could change `hsv` to `jet`, `cool`, ... alpha = .5; %// define level of transparency t = 0 : .1 : 2 * pi; hold on; for i = 1 : nCircles x = Radius(i) * cos(t) + Circles(i,1); y = Radius(i) * sin(t) + Circles(i,2); patch(x, y, cmap(i,:), facealpha, alpha, edgecolor, none); %// plot filled circle with transparency end axis equal; %// same aspect ratio in both axes grid on;
