四川民族学院论坛(BBS)
用matlab画出来的蜗牛,神奇吧~ - 可打印的版本

+- 四川民族学院论坛(BBS) (https://scun.net)
+-- 版块: 一区 (https://scun.net/forum-1.html)
+--- 版块: 校园聊吧 (https://scun.net/forum-3.html)
+--- 主题: 用matlab画出来的蜗牛,神奇吧~ (/thread-81.html)



用matlab画出来的蜗牛,神奇吧~ - bbs - 08-29-2012

[图: BxTWN.jpg]
代码:
程序

t = linspace(0, 2*pi, 512);
[u,v] = meshgrid(t);
a = -0.4; b = .5; c = .1;
n = 3;
x = (a*(1 - v/(2*pi)) .* (1+cos(u)) + c) .* cos(n*v);
y = (a*(1 - v/(2*pi)) .* (1+cos(u)) + c) .* sin(n*v);
z = b*v/(2*pi) + a*(1 - v/(2*pi)) .* sin(u);
surf(x,y,z,y)
axis off
axis equal
colormap(hsv(1024))
shading interp
material shiny
lighting phong
camlight('left', 'infinite')
view([-160 25])