How to plot multidimensional array with three variable

1 view (last 30 days)
Hello,
My function is ratio=ratio(x,y,z) And ratio is multidimensional array as a 4x4x4
val(:,:,1) =
0.0378 0.0642 0.0824 0.0973
0.0480 0.0770 0.0980 0.1142
0.0541 0.0845 0.1068 0.1236
0.0574 0.0899 0.1128 0.1311
val(:,:,2) =
0.0392 0.0750 0.1041 0.1277
0.0520 0.0953 0.1277 0.1541
0.0601 0.1068 0.1412 0.1689
0.0655 0.1142 0.1500 0.1791
val(:,:,3) =
0.0392 0.0770 0.1122 0.1426
0.0520 0.1014 0.1426 0.1764
0.0608 0.1155 0.1595 0.1953
0.0669 0.1257 0.1709 0.2081
val(:,:,4) =
0.0392 0.0770 0.1155 0.1493
0.0520 0.1034 0.1500 0.1899
0.0608 0.1196 0.1703 0.2122
0.0669 0.1304 0.1831 0.2270
And also x, y and z are (1x4) vectors. How can I plot contour map in a cubic system as can be seen in figure ?

Answers (1)

Walter Roberson
Walter Roberson on 15 Dec 2015
slice() the data on the three planes corresponding to the outside of the data.
The Z labels in the diagram are inconsistent. To be consistent with the interior values, 0 on the Z axis would have to be at the center bottom (the "front bottom" corner) and 2Pi on the Z axis would have to be at the right bottom (the "back bottom" corner).
  1 Comment
yusuf
yusuf on 16 Dec 2015
Edited: yusuf on 16 Dec 2015
These are my variables
ratio=ratio(x,y,z)
x=[0.1 0.2 0.3 0.4] y=[0.2 0.4 0.6 0.8] z=[0.05 0.1 0.15 0.2]
First of all , I tied scatter3 but I got only points, could not get the distribution.
xgv = 0.1:.1:0.4;
ygv = 0.2:.2:0.8;
zgv=0.05:0.05:0.2;
[x, y, z] = meshgrid(xgv,ygv,zgv);
scatter3(x(:),y(:),z(:),10,ratio(:),'filled');
colormap(jet);
colorbar;

Sign in to comment.

Categories

Find more on Contour Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!