Stats

341,829

Popular Posts

Followers

Mathematica 教學 Plotting contours with Plot3D

戴忠淵 於 2011年6月8日星期三 下午5:08 發表

如何在Mathematica的3D繪圖中自訂格線?
Plot3D[Sin[x + y], {x, -2 Pi, 2 Pi}, {y, -2 Pi, 2 Pi}]


Show[Plot3D[
Sin[x+y],{x,-2Pi,2Pi},{y,-2Pi,2Pi},

(*使用MeshFunction畫出以圓點為圓心的格線*)

MeshFunctions->Function[{x,y},x^2+y^2],
MeshStyle->{Red,Thickness[0.005]}],

(*新增一條特定格線*)

Graphics3D[{Green,Thickness[0.01],
Map[Line,Partition[{#[[1]],#[[2]],Sin[#[[1]]+#[[2]]]}&/@
ContourPlot[x^2+y^2==Pi,{x,-2Pi,2Pi},{y,-2Pi,2Pi}][[1,1]],2,1]]}]
]






SphericalPlot3D[1, {\[Phi], 0, Pi}, {\[Theta], 0, 2 Pi}]



f[\[Theta]_, \[Phi]_] = Sin[\[Theta] + \[Phi]];
SphericalPlot3D[1, {\[Phi], 0, Pi}, {\[Theta], 0, 2 Pi}, ColorFunctionScaling->False,
(*相對於其他的繪圖函數,MeshFunction也是適用!*)
MeshFunctions->{Function[{x, y, z, \[Theta], \[Phi], r}, f[\[Phi], \[Theta]]]},
MeshStyle->{Red, Thickness[0.005]}]

Tags:

讀者回應 ( 0 意見 )

發佈留言

Please leave your name and tell me what you thought about this site. Comments, suggestions and views are welcomed.

如果這篇文章對你有幫助,那請留個訊息給我~