Plotting the function on a Sphere?
6 ビュー (過去 30 日間)
古いコメントを表示
Let me explain, what I'm actually solving.
I'm solving Diffusion-Reaction equation(3D) in spherical coordinates.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1104510/image.png)
I'm solving this equation numerically. So at the end I'm getting
, r, θ, ϕ.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1100050/image.png)
So I want to plot this function
on a sphere(
- plane) instead of
palne
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1100050/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1100060/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1100065/image.png)
Can anyone help in this regard?
Thanks in advance.
0 件のコメント
回答 (1 件)
KSSV
2022 年 8 月 17 日
編集済み: KSSV
2022 年 8 月 17 日
r = 1 ;
th = linspace(0,2*pi) ;
phi = linspace(0,pi) ;
[T,P] = meshgrid(th,phi) ;
X = r*cos(T).*sin(P) ;
Y = r*sin(T).*sin(P) ;
Z = r*cos(P) ;
surf(X,Y,Z)
axis equal
2 件のコメント
Torsten
2022 年 8 月 22 日
What do you think: why does the surface of the sphere have different colors ?
参考
カテゴリ
Help Center および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!