polar plot 3d by data

1 vue (au cours des 30 derniers jours)
LUIGI BIANCO
LUIGI BIANCO le 26 Oct 2018
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

Réponses (1)

Star Strider
Star Strider le 26 Oct 2018
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.

Catégories

En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by