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

📄 cyl2.m

📁 hi i have a huge collection are you interested
💻 M
字号:
N = 100; % Number of points around the circleM = 30; % Number of circles in the cylinderdt = 2*pi/N;t = (0:dt:(N-1)*dt)';h = linspace(0,1,M); % vector of heightsxv = cos(t);yv = sin(t);% Reproduce the vertices at different heights:x = repmat(xv,M,1);y = repmat(yv,M,1);z = ones(N,1)*h;z = z(:);vert = [x y z];% These are the facets of a single 'layer':facets = zeros(N,4);facets(1:N-1,1) = (1:N-1)';facets(1:N-1,2) = ((N+1):(2*N-1))';facets(1:N-1,3) = ((N+2):(2*N))';facets(1:N-1,4) = (2:N)';facets(N,:) = [N 2*N N+1 1];% Reproduce the layers at the different heights:faces = zeros((M-1)*N,4);for i=1:M-1  rows = (1:N) + (i - 1)*N;  faces(rows,:) = facets + (i - 1)*N;end%Define heat source and temperature:xs = -0.5;ys = 0;zs = 0.25;dist = sqrt((x - xs).^2 + (y - ys).^2 + (z - zs).^2);T = 1./dist;clfcolormap(hot)h = patch('vertices',vert,'faces',faces,'facevertexcdata',T,...    'facecolor','interp',...    'edgecolor',[.5 .7 0],...    'linestyle','.');view(78,36)axis equal% Plot the source:hold onplot3([xs xs],[ys ys],[0 zs])plot3(xs,ys,zs,'*')

⌨️ 快捷键说明

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