当前位置:网站首页>Drawing with MATLAB (2) -- color ring

Drawing with MATLAB (2) -- color ring

2022-06-26 08:47:00 NBb-666

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

Input parameters theta Controls the clockwise rotation angle of the color ring .
Command line window input

colorwheel(90);

Available
 Color ring

原网站

版权声明
本文为[NBb-666]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202170554361571.html