Plotting 3D for three independent variables without any function

34 ビュー (過去 30 日間)
Yaser Khojah
Yaser Khojah 2019 年 3 月 21 日
コメント済み: M Naeem 2021 年 7 月 24 日
I have four vectors as attached in Data_1.tx. file. I'm looking for a way to plot their surface map. Where X = (:,column3), Y = (:,column 2) and Z = (:,Column 1). I have looked into meshgrid but did not work since I do not have a function to estimate Z from given X and Y Values. They are only data. I have found and tried this below code but did not like the graph.
trisurf(delaunay(X,Y),X,Y,Z)
I have tried Scatter 3 as below and I do not like it. Is there anyway to present them as the below colourful box? Thank you for your help. scatter.png
  5 件のコメント
Walter Roberson
Walter Roberson 2020 年 10 月 14 日
t = readtable('Surface plot.xlsx');
x = t.Temp; y= t.Pressure; z = t.Time;
tri = delaunay(x,y);
trimesh(tri, x, y, z);
Amanullah Khan
Amanullah Khan 2020 年 10 月 19 日
Thank you so much Mr Walter. It worked for me.

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

採用された回答

Walter Roberson
Walter Roberson 2019 年 3 月 21 日
編集済み: Walter Roberson 2019 年 3 月 21 日
For a typical surface map, you would use
interpolated_z = griddata(X, Y, Z, query_x, query_y);
surf(query_x, query_y, interpolated_z, 'edgecolor', 'none')
However, the example diagram you give is an example of using https://www.mathworks.com/help/matlab/ref/slice.html on a 3D grid of data. You do not have the information necessary for that -- not unless the unused 4th column of your input is value information.
When I look at your data, it looks to me to be more likely that your first column is value information and that your remaining three columns are X, Y, Z coordinates, rather than your first column being Z coordinates.
  6 件のコメント
Yaser Khojah
Yaser Khojah 2019 年 3 月 21 日
Thank you so much, this is really useful. Is V presented by the colorbar? slic.png
Walter Roberson
Walter Roberson 2019 年 3 月 21 日
Yes, V is represented as color.
You can also create a diagonal set of query points, and hold on and slice() with it. When I looked at the data I could not see any particular angle that it would make sense to slice at.

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

その他の回答 (1 件)

M Naeem
M Naeem 2021 年 7 月 23 日
can you please help in plotting graph of f(x,y,z)=2x+5xy+11xyz+2z
  2 件のコメント
Walter Roberson
Walter Roberson 2021 年 7 月 24 日
N = 50;
xvec = linspace(-5,5,N);
yvec = linspace(-5,5,N);
zvec = linspace(-5,5,N);
[X,Y,Z] = meshgrid(xvec, yvec, zvec);
fxyz = 2 .* X + 5 .* X .* Y + 11 .* X .* Y .* Z + 2 .* Z;
minf = min(fxyz(:));
maxf = max(fxyz(:));
levels = linspace(minf, maxf, 9);
levels = levels(2:end-1);
nlev = length(levels);
for K = 1:nlev
L = levels(K);
isosurface(X, Y, Z, fxyz, L, fxyz);;
end
camlight; lighting phong
legend( string(levels) );
colorbar
hold off
M Naeem
M Naeem 2021 年 7 月 24 日
Thank you soo much ...

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

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by