首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Matlab中的三维红细胞图

Matlab中的三维红细胞图
EN

Stack Overflow用户
提问于 2014-03-07 08:16:01
回答 2查看 642关注 0票数 1

大家好,我在mat实验室做了一个红细胞三维模型,我所想出的只是一个扁平的球,我想在球体的两边做一个凹陷,想出一个--至少是一个真实的红细胞--我的代码如下所示,我应该添加什么来建立一个真实的红细胞模型?

代码语言:javascript
复制
a=1;
c=5;
[u,v]= meshgrid(0:10:360);
x=(a-c*cosd(v)).*cosd(u);
y=(a - c*cosd(v)).*sind(u);
z=a*sind(v);
surf(x,y,z)
axis equal;

这是我尝试过的代码,但仍然不接近我所期望的。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-03-22 13:28:58

代码语言:javascript
复制
    rouleaux = 0;
halfplot = 1;
[X,Y,Z]=sphere(200);
figure(gcf);
clf
Z = Z.*(0.1+0.4.*(X.^2+Y.^2).^1);
th=atan2(X,Y);
if halfplot
    %surfl(   X,Y,Z./( (th>(pi/4+0.1)) + (th<(-3+pi/4)).*(th>(-3*pi/4-1)) )   );
     surfl(   X,Y,Z./((th<pi/4+0.1).*(th>-3*pi/4+0.1))    );
else
    surfl(X,Y,Z);
end
if rouleaux
    hold on
    surfl(X+0.1,Y-0.1,Z+0.5);
    surfl(X+0.1,Y+0.1,Z-0.5);
    surfl(X-0.1,Y,Z-1);
    surfl(X,Y-0.15,Z-1.5);
end
shading interp;
axis equal
grid off;
whitebg('k')
set(gcf,'color','k')
axis off
colormap hot
light
caxis([-0 1.25])
view([176 14])
hold off;
票数 0
EN

Stack Overflow用户

发布于 2014-03-07 09:45:18

嗯,我还是不太高兴(看上去更像红蜡沟达干酪而不是血细胞),但是哦,好吧:

代码语言:javascript
复制
%// Parameters:
a = 0.2; %// Z in the middle
b = 0.8; %// Z at the edge
c = 5;   %// diameter of the bloodcell
n = 50;  %// number of pionts to use on the surf

%// This is copied largely from sphere()
theta = pi * (-1:2/n:1);
phi   = pi/2 * (-1:2/n:1).';

cosphi   = cos(phi);     cosphi(1)   = 0;   cosphi(n+1)   = 0;
sintheta = sin(theta);   sintheta(1) = 0;   sintheta(n+1) = 0;

%// (except for this part)
A = bsxfun(@power, [0; pi/4; pi/2; 3*pi/4; pi], 4:-1:0);
b = [0; b; a; b; 0];
C = A\b;
F = @(phi) sign(phi) .* reshape( (bsxfun(@power, mod(phi(:),pi), 4:-1:0))*C, size(phi) );

x = c * cosphi*cos(theta);
y = c * cosphi*sintheta;
z = F(phi) * ones(1,n+1);


%// Now make the awesome plot
surf(x,y,z,abs(z), 'edgecolor', 'none')
axis equal, grid off, axis off

map = [linspace(0.5,1,n).', zeros(n,1), zeros(n,1)];
colormap(map)

set(gcf, 'Renderer', 'OpenGL');
shading interp, material shiny, lighting phong, lightangle(0, 55)
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22244872

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档