matlab应该怎么进行编程呀?

img

你好同学,这就是考察对旋转图形的理解,一般用比如xy平面的一个圆,然后绕着y轴旋转,就得到了环

x0 = 3;  y0=1; r0 = 1; 
theta1 = linspace(0,2*pi, 20);
theta2 = linspace(0,2*pi, 100);
[T1, T2] = meshgrid(theta1, theta2);
X = (r0*cos(T1)+x0).*cos(T2);
Y = r0*sin(T1);
Z = (r0*cos(T1)+x0).*sin(T2);
figure(2);clf
h = mesh(X,Y,Z);
hold on
h1 = mesh(Y,X,Z+x0+r0);
shading flat;axis equal off;
view(15,45);
set(h,'facecolor','r','edgecolor','none')
set(h1,'facecolor','g','edgecolor','none')
light('position',[0,0,20],'style','local','color','w');lighting phong;
light('position',[-20,0,0],'style','local','color','w');lighting phong;

img

然后画自己认为喜欢的图形

figure;
s=1000;
I=ones(s,s,3);
w=2.2;
for h=1:s
 for k=1:s
 z=((k-s/2)-i*(h-30-s/2))*w/s;
 for r=1:6
 z=z^5-0.65*i-0.0001/z^5+0.0001;
 end
 r=real(z);
 a=0.0001*r^2;
 I(h,k,1)=min(0.9,-4*r+a);
 I(h,k,2)=min(0.9,-r+a);
 I(h,k,3)=min(1,3*r+a);
 end
end
imshow(I)

img

答题不易如有帮助还望题主给个宝贵的采纳支持一下答主答题哟谢谢啦(づ ̄3 ̄)づ╭❤~