如何在matlab中画星座图?
函数星座
图(' WindowButtonDownFcn ',@wbdcb)
ah = axes('DrawMode ',' fast ');
坐标轴([1 10 1 10])
标题(“画一个星座”)
color 1 = ' brcmkgy ';
num = 1;
函数wbdcb(src,evnt)
if strcmp(get(src,' SelectionType '),' normal ')
集合(src,'指针','圆圈')
cp = get(啊,' current point ');
xinit = cp(1,1);yinit = cp(1,2);
hl = line('XData ',xinit,' YData ',yinit,...
标记',' p ','颜色',color 1(num));
set(src,' WindowButtonMotionFcn ',@wbmcb)
set(src,' WindowButtonUpFcn ',@wbucb)
结束
功能wbmcb(src,evnt)
cp = get(啊,' current point ');
xdat = [xinit,cp(1,1)];
ydat = [yinit,cp(1,2)];
set(hl,' XData ',xdat,' YData ',ydat);drawnow
结束
函数wbucb(src,evnt)
if strcmp(get(src,' SelectionType '),' alt ')
num = num+1;
如果num & gt七
num = 1;
结束
集合(src,'指针','箭头')
set(src,' WindowButtonMotionFcn ','')
set(src,' WindowButtonUpFcn ','')
其他
返回
结束
结束
结束
结束