3Dplot suggestions on azimuthal data

조회 수: 1 (최근 30일)
Ionut  Anghel
Ionut Anghel 2021년 7월 29일
댓글: Ionut Anghel 2021년 7월 29일
Hi,
I never used 3D plot in Matlab. I will like to plot in 3D, the data from the the attached file. I was trying in Excel and the results is
not very good. I would like to have some sugestions how to use mesh here.
Thank you,
Ionut

채택된 답변

Adam Danz
Adam Danz 2021년 7월 29일
There are lots of 3D plots. Here are two examples using a 3D bar plot and a 3D surface.
data = [ 45 33 25 60 32 34 50 9
5 61 17 71 18 7 7 6
37 41 20 19 20 47 27 20
8 8 9 11 11 10 9 8];
col = 0:45:315;
rows = {'Low','Mid','Upp','Out'}';
figure()
bar3(data)
set(gca, 'XTick', 1:size(data,2), 'XTickLabel',compose('%g',col), ...
'YTick',1:size(data,1), 'YTickLabel',rows);
xlabel('Azimuth (deg)')
ylabel('level')
zlabel('value')
figure()
surf(col,1:size(data,1),data)
colormap(gca,'gray')
set(gca, 'XTick',col, 'YTick',1:size(data,1), 'YTickLabel',rows);
xlabel('Azimuth (deg)')
ylabel('level')
zlabel('value')
  댓글 수: 1
Ionut  Anghel
Ionut Anghel 2021년 7월 29일
Very nice solutions!
They are working perfect.
Thank you.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Bjorn Gustavsson
Bjorn Gustavsson 2021년 7월 29일
You seem to have your x and y-coordinate values along the first row and column of the data. If so:
x = test(1,2:end);
y = test(2:end,1);
z = test(2:end,2:end);
Then you can plot with surf or mesh:
subplot(2,2,1)
surf(x,y,z)
subplot(2,2,2)
mesh(x,y,z)
Or you can use scatter or scatter3:
subplot(2,2,3)
scatter(x(:),y(:),32,z(:),'filled')
subplot(2,2,4)
scatter3(x(:),y(:),z(:),32,z(:),'filled')
Then you can play around with the other plotting-functions too...
HTH
  댓글 수: 1
Ionut  Anghel
Ionut Anghel 2021년 7월 29일
Your answwer is very good as well. I had to arrange the vectors. Matlab doesn't allowed me to accept both answers.
Thank you.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by