⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 torus.m

📁 hi i have a huge collection are you interested
💻 M
字号:
function  [xx,yy,zz] = torus(r,n,a)%TORUS Generate a torus%      torus(r,n,a) generates a plot of a torus with central%      radius  a  and lateral radius  r.  n  controls the number%      of facets on the surface.  These input variables are optional%      with defaults  r = 0.5, n = 20, a = 1.%%      [x,y,z] = torus(r,n,a) generates three (n+1)-by-(2n+1)%      matrices so that surf(x,y,z) will produce the torus.% %      See also SPHERE, CYLINDER%%%  Kermit Sigmon, 11-22-93if nargin < 3, a = 1; endif nargin < 2, n = 20; endif nargin < 1, r = 0.5; endtheta = pi*(0:2*n)/n;phi   = 2*pi*(0:n)'/n;x = (a + r*cos(phi))*cos(theta);y = (a + r*cos(phi))*sin(theta);z = r*sin(phi)*ones(size(theta));if nargout == 0   surf(x,y,z)   ar = (a + r)/sqrt(2);   axis([-ar,ar,-ar,ar,-ar,ar])else   xx = x; yy = y; zz = z;end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -