フィルターのクリア

plot volumetric spherical coordinate data

5 ビュー (過去 30 日間)
Anandu S
Anandu S 2019 年 9 月 21 日
編集済み: darova 2019 年 9 月 22 日
How to plot the volumetric spherical coordinate data?
theta=-pi:0.1:pi;
phi=-pi/2:0.1:pi/2;
r=0:10;
[theta phi r]=meshgrid(theta,phi,r);
f= r+theta+phi;

回答 (1 件)

darova
darova 2019 年 9 月 22 日
編集済み: darova 2019 年 9 月 22 日
Use isosurface to plot data at specific value
example
clc,clear
% generate some data
theta1 = linspace(-1,1,60)*pi;
phi1 = linspace(-1,1,20)*pi/2;
r1 = 0:10;
[theta, phi, r] = meshgrid(theta1,phi1,r1);
f = r + cos(10*theta);
% boundaries of volume
[X,Y,Z] = sphere(20);
X = r1(end)*X;
Y = r1(end)*Y;
Z = r1(end)*Z;
% create isosurface where f=5
p = patch(isosurface(theta,phi,r,f,5));
% extract spherical data
fc = get(p,'Faces');
vc = get(p,'Vertices');
% convert spherical data to cartesian
[x1,y1,z1] = sph2cart(vc(:,1),vc(:,2),vc(:,3));
vc = [x1 y1 z1];
% plot boundaries
cla
surf(X,Y,Z,'Facecolor','none','edgeColor',[1 1 1]*0.5)
hold on
% plot data f=5 in cartesian
h = patch('Faces',fc,'Vertices',vc);
hold off
set(h,'FaceColor','r','EdgeColor','none');
camlight
lighting gouraud
See my comment HERE of using slice in spherical system coordinates
EDITED: displaying isosurface with patch()

カテゴリ

Help Center および File ExchangeScalar Volume Data についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by