Trying to plot 4D data

16 ビュー (過去 30 日間)
Amin KLS
Amin KLS 2022 年 4 月 7 日
コメント済み: Amin KLS 2022 年 4 月 8 日
I'm trying to plot my data as a 4D figure like attached image, but I don’t know which command should be used.
I would be grateful if someone could help me with this, thank you.
x=[1;2;3;4;5;6]
y=[20;40;60;80;100;120]
z=[7.5 6.4 5.4 4.7 4.6 7.3
8 7 6.3 5.9 6.2 9.3
7.6 6.9 7.6 10.6 17.8 38.8
8.9 9 10.8 15.1 24.6 52.2
9.9 10.4 12.5 17.2 27.4 57.6
11.8 12.9 15.6 21 32.6 67.2
]
u=[1.166095944 0.97358166 0.779831701 0.585208118 0.390139923 0.194918905
1.125081616 0.938075367 0.750416267 0.56248955 0.374665613 0.187071512
1.299656109 1.085162773 0.869349505 0.6528042 0.435361439 0.217700286
1.33599592 1.114982352 0.893254036 0.670663527 0.447356191 0.223576511
1.353130634 1.129064616 0.904218619 0.678721998 0.452633899 0.226149653
1.383264964 1.153932529 0.923799929 0.693105559 0.462123411 0.230823789
]

採用された回答

Voss
Voss 2022 年 4 月 8 日
In the sample image, it looks like Z = U, i.e., the color of the surface corresponds to a U-value which is equal to the Z-value of the surface. That's not the case here, since here the variable z is not equal to the variable u.
Nevertheless, you can create a surface that uses x, y, and z as its spatial coordinates and u as its color.
x=[1;2;3;4;5;6];
y=[20;40;60;80;100;120];
z=[7.5 6.4 5.4 4.7 4.6 7.3
8 7 6.3 5.9 6.2 9.3
7.6 6.9 7.6 10.6 17.8 38.8
8.9 9 10.8 15.1 24.6 52.2
9.9 10.4 12.5 17.2 27.4 57.6
11.8 12.9 15.6 21 32.6 67.2
];
u=[1.166095944 0.97358166 0.779831701 0.585208118 0.390139923 0.194918905
1.125081616 0.938075367 0.750416267 0.56248955 0.374665613 0.187071512
1.299656109 1.085162773 0.869349505 0.6528042 0.435361439 0.217700286
1.33599592 1.114982352 0.893254036 0.670663527 0.447356191 0.223576511
1.353130634 1.129064616 0.904218619 0.678721998 0.452633899 0.226149653
1.383264964 1.153932529 0.923799929 0.693105559 0.462123411 0.230823789
];
% hard to say which one of these four is the correct way to depict
% these data:
surf(x,y,z,u);
% surf(x,y,z.',u.');
% surf(x,y,z.',u);
% surf(x,y,z,u.');
cb = colorbar();
xlabel('X')
ylabel('Y')
zlabel('Z')
ylabel(cb,'U','Rotation',0);
  1 件のコメント
Amin KLS
Amin KLS 2022 年 4 月 8 日
It's exactly what I needed, thank you for your assistance.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by