【问题标题】:Plotting a function of Theta and Phi as a color plot on a sphere将 Theta 和 Phi 的函数绘制为球体上的颜色图
【发布时间】:2015-03-05 03:02:50
【问题描述】:

我正在尝试在我的 Matlab 课堂上准备这个练习(作为 CS 工程师应用物理实验室的一部分),您必须在其中模拟行星表面的温度波动,该行星的一侧总是面向母星,另一侧一边总是远离它(半冷冻半烤)。这是我正在使用的功能:

T(Theta, Phi) = T0 + T1*sin^2(Theta) + T2*(1+sin(Phi))

我想在球体表面上将上述函数绘制为彩色图,即表面上一个点的颜色应该代表该点的温度 T。我该怎么做呢?

到目前为止,我所做的一切都给了我这样的情节:

我想要像下图这样的东西,但颜色分布当然不同,根据我上面给出的功能给出。

【问题讨论】:

  • "I want to plot the above function on a surface of a sphere" 是什么意思?一个球体就是一个球体。您是说要将颜色映射到球体上吗?或者你想创建一个具有上述形状的封闭 3D 对象,即只是使相应侧的边缘可以这么说?
  • 意思是,球体表面某一点的颜色应该代表该点的温度值,(Theta, Phi)。
  • 类似这样的东西,i.stack.imgur.com/HQXDC.png。当然有不同的颜色分布,根据我在问题中给出的功能给出。

标签: matlab surface


【解决方案1】:

这部分完成了:

T0 = 2 ; T1 = 30  ; T2 = 120 ; %// set your boundary conditions here

[X,Y,Z] = sphere(50) ; %// generate coordinates of a sphere
hs = surf(X,Y,Z)     ; %// display the sphere and retrieve the handle to the graphic object
axis equal           ; %// set the axis ratio so the sphere appear as a sphere
shading interp       ; %// small refinement to not see the grid, you can comment that

[azimuth,elevation,r] = cart2sph(X,Y,Z) ;               %// Convert cartesian coordinates to spherical referential
T = T0 + T1*sin(azimuth).^2 + T2.*(1+sin(elevation)) ;  %// Calculate the temperature according to your model
set(hs,'CData',T) ;                                     %// update the sphere graphic object with the new temperature as a collor coding

现在您仍然需要调整初始条件T0T1T3,并且还可以添加一些旋转,以防您的“热”和“冷”点不在两极。

【讨论】:

  • 创建 T 后也可以进行 surf(X, Y, Z, T)。
  • @nivag,确实如此。我们甚至可以进一步减少线的数量,但是看到 OP 如何在绘制球形时遇到问题,我选择将 球形绘制温度数据应用 操作分开。
  • 谢谢霍基!看起来和我想要的一模一样!
猜你喜欢
  • 1970-01-01
  • 2018-09-19
  • 2019-03-02
  • 2019-04-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多