function [] = colorwheel(theta)
h = figure(1);
set(h,'outerposition',[300 300 200 200],'color','w')
x1 = 0;
y1 = 0;
t = (0:.02:2)*pi;
r1 = 0:.02:0.3;
r2 = .3:.02:0.8;
r3 = 0.8:.02:1;
r1 = r1*1;
xp1 = x1+cos(t)'*r1;
yp1 = y1+sin(t)'*r1;
xp2 = x1+cos(t)'*r2;
yp2 = y1+sin(t)'*r2;
xp3 = x1+cos(t)'*r3;
yp3 = y1+sin(t)'*r3;
hold on
%pcolor(x,y,t'*(r1==r1));
surface(xp1,yp1,t'*(r1 == r1),'FaceAlpha',0);
surface(xp2,yp2,t'*(r2 == r2));
colormap(hsv(256))
shading interp
surface(xp3,yp3,t'*(r3 == r3),'FaceColor',[0 0 0]);
axis equal off
view(theta,90)
set(gca,'position',[0 0 1 1])
end
输入参数theta控制色环顺时针旋转的角度。 命令行窗口输入
colorwheel(90);
可得
|