polar plot 3d by data

조회 수: 4 (최근 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