matlab作图请教

来源:百度知道 编辑:UC知道 时间:2024/06/14 20:18:32
一个64*64的方阵,元素值为0~1的随机数
怎样做一个图把小于0.5的元素标为蓝色圈,大于0.5的标为红色圈
谢谢,哪位大侠解答下

A=rand(64);
B=A<.5;
[x,y]=meshgrid(1:64);
figure('color','w')
scatter(x(:),y(:),20,B(:))
axis ij off ;colormap([1 0 0;0 0 1])

m=rand(64);
for k=1:64
for l=1:64
rectangle('position',[k-1,l-1,1,1],'curvature',0.5);
end
end
drawnow;