如何用mathematica或者matlab画三维图形,例如旋转抛物面 x^2+z^2=60y , (y,0,21.6).希望能给出详细代码。

如题所述

No intention to get the reward. Just show how powerful the Mathematica is!

The basic idea is from neu_lin.

 

ContourPlot3D[
 x^2 + z^2 == 60 y, {x, -40, 40}, {y, 0, 21.6}, {z, -40, 40}, 
 Mesh -> None, ContourStyle -> Directive[Opacity[0.5], Red], 
 ColorFunction -> Function[{x, y, z, f}, Hue[z]]]

ContourPlot3D[

 x^2 + z^2 == 60 y, {x, -40, 40}, {y, 0, 21.6}, {z, -40, 40}, 

 ColorFunction -> Function[{x, y, z, f}, Hue[Sin[x] Sin[z]]], 

 ColorFunctionScaling -> False, Mesh -> None]

 

ContourPlot3D[

 x^2 + z^2 == 60 y, {x, -40, 40}, {y, 0, 21.6}, {z, -40, 40}, 

 MeshFunctions -> {#1 - #2 &, #1 + #2 &}, 

 MeshShading -> {{Yellow, Blue}, {Green, Cyan}}, 

 ColorFunction -> Function[{x, y, z, f}, ColorData["Rainbow"][z]], 

 Mesh -> 4, 

 ContourStyle -> 

  Directive[Orange, Opacity[0.6], Specularity[White, 30]]]

 

 

 

ContourPlot3D[

 x^2 + z^2 == 60 y, {x, -40, 40}, {y, 0, 21.6}, {z, -40, 40}, 

 MeshFunctions -> {#3 &}, 

 ContourStyle -> Directive[Opacity[0.5], Yellow], 

 MeshShading -> {Red, Automatic}]

 

 

ContourPlot3D[

 x^2 + z^2 == 60 y, {x, -40, 40}, {y, 0, 21.6}, {z, -40, 40}, 

 Mesh -> None, 

 ColorFunction -> Function[{x, y, z, f}, ColorData["Rainbow"][z]], 

 Mesh -> 4, 

 ContourStyle -> 

  Directive[Orange, Opacity[0.6], Specularity[White, 30]]]

 

 

 

温馨提示:内容为网友见解,仅供参考
第1个回答  2012-07-26

figure;

bound=sqrt(60*21.6);

[x,z]=meshgrid(linspace(-bound,bound));

y=(x.^2+z.^2)/60;

y(y>21.6)=NaN;

mesh(x,y,z);

xlabel('x');ylabel('y');zlabel('z');

 

效果图如下图:

本回答被网友采纳
第2个回答  2012-07-28

自己看看啊

ContourPlot3D[x^2+z^2==60 y,{x,-40,40},{y,0,21.6},{z,-40,40},Mesh->None]

相似回答