My data is x,y,z,w. How can I create a 3D contour plot of it?

1 回表示 (過去 30 日間)
Ewen Chan
Ewen Chan 2017 年 6 月 28 日
コメント済み: Yuli Han 2019 年 12 月 9 日
I have a tab delimited text file (see attached) that has x,y,z data from a design of experiments sweep and the output variable is w.
I tried using this:
fidi=fopen('DOE sweep1A.txt', 'rt'); % version of text file without headers
D=textscan(fidi, %f%f%f%f');
X=D{1}; % rpm
Y=D{2}; % m_dot
Z=D(3); % P
W=D{4); % Power
N=100;
Xi=linspace(min(X),max(X),N);
Yi=linspace(min(Y),max(Y),N);
Zi=linspace(min(Z),max(Z),N);
[Gx,Gy,Gz]=meshgrid(Xi,Yi,Zi);
Wi=griddata(X, Y, Z, W, Gx, Gy, Gz, 'natural');
contour(Gx, Gy, Gz, Wi, 'Linestyle', '-', 'Linecolor', [0 0 0], 'ShowText', 'on', 'LevelStep', 1)
grid on
colormap(jet)
colorbar;
And I know that it doesn't work because it can only have 2 dimensions and also that there are repeating numbers for X, Y, and Z because it is a design of experiments sweep.
But I would still want to plot this preferably in a 3D contour plot.
Is there a way to do so?
Thanks.
  2 件のコメント
KSSV
KSSV 2017 年 6 月 29 日
Yours is a volumetric data, not a surface data. What you expect?
Ewen Chan
Ewen Chan 2017 年 6 月 29 日
I didn't expect anything from it.
I was just recycling an old solution that I got from here and tried to use it for a new problem.

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

回答 (2 件)

Walter Roberson
Walter Roberson 2017 年 6 月 29 日
You might want to experiment with isosurface(). You might want to ask it to draw at several different surface levels
  3 件のコメント
Walter Roberson
Walter Roberson 2017 年 6 月 29 日
We can't say, as you have not defined your desired output in any useful way. What would you expect a "3d contour plot" to look like? Do you have an example plot?

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


John Mickett
John Mickett 2019 年 8 月 6 日
It is a good question. He wants to do output of surf.m with three coords but instead of colored contours wants lines. Not a hard concept.
surf(X,Y,Z,C) but instead of C you have contour intervals.
  4 件のコメント
Yuli Han
Yuli Han 2019 年 12 月 7 日
Hi John,
I have a similar problem recently. The figure you showed above is right what I need. Could you please share the code or tell more detail about how to draw it? Much appreciated.
Yuli Han
Yuli Han 2019 年 12 月 9 日
I have just solved this problem. Thanks!

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by