polar plot 3d by data

1 次查看(过去 30 天)
LUIGI BIANCO
LUIGI BIANCO 2018-10-26
回答: Star Strider 2018-10-26
I have a series of polar coordinates that describe the circumferences at different heights, how can I make a 3D plot? angle = theta(radians) radius=r height=h I am attaching 3 txt files corresponding to the coordinates of the circumferences at different heights

回答(1 个)

Star Strider
Star Strider 2018-10-26
I am not certain what you want.
Try this:
fidi = fopen('z0.txt','rt');
D0 = textscan(fidi, '%s%s%d', 'HeaderLines',1, 'CollectOutput',1);
D0{1} = str2double(strrep(D0{1}, ',','.'));
[D0x,D0y,D0z] = pol2cart(D0{1}(:,1), D0{1}(:,2), D0{2});
fclose(fidi);
fidi = fopen('z10.txt','rt');
D10 = textscan(fidi, '%s%s%d', 'HeaderLines',1, 'CollectOutput',1);
D10{1} = str2double(strrep(D10{1}, ',','.'));
[D10x,D10y,D10z] = pol2cart(D10{1}(:,1), D10{1}(:,2), D10{2});
fclose(fidi);
fidi = fopen('z20.txt','rt');
D20 = textscan(fidi, '%s%s%d', 'HeaderLines',1, 'CollectOutput',1);
D20{1} = str2double(strrep(D20{1}, ',','.'));
[D20x,D20y,D20z] = pol2cart(D20{1}(:,1), D20{1}(:,2), D20{2});
fclose(fidi);
then:
figure
plot3(D0x,D0y,D0z) % Line Plots
hold on
plot3(D10x,D10y,D10z)
plot3(D20x,D20y,D20z)
hold off
grid on
axis equal
Dx = [D0x,D10x,D20x];
Dy = [D0y,D10y,D20y];
Dz = [D0z,D10z,D20z];
figure
surf(Dx, Dy, Dz) % Surface Plot
grid on
axis equal
The plots are approximately identical circles at various elevations, so I will not post them.

类别

Help CenterFile Exchange 中查找有关 Creating, Deleting, and Querying Graphics Objects 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by