Plotting in 3D

Hi, I am trying to plot 3 variables in the x,y,z plane in MATLAB.However, I keep getting an error.
I have 3 sets of data,
h = [0.015 0.02 0.025 0.03 0.035 0.04];
Tout = [311.32 317.72 323.94 329.54 334.35 338.42];
Area = [0.72 1.28 2 2.88 3.92 5.12];
How can I get a mesh that shows h on the x axis, Tout on the y axis & Area on the z axis?
Regards

1 件のコメント

Cris LaPierre
Cris LaPierre 2020 年 4 月 12 日
There is not enough data. To plot in 3D, you need to know the area for every combination of h and Tout. Therefore, Area needs to be a matrix where the rows correspond to the values of Tout, and the columns correspond to the values of h.
For example, I can see that when h=0.015 and Tout=311.32, Area=0.72. But what is the Area when h=0.015 and Tout=338.42?

回答 (1 件)

Star Strider
Star Strider 2020 年 4 月 12 日

0 投票

With your data, this is likely the best you dan do:
h = [0.015 0.02 0.025 0.03 0.035 0.04];
Tout = [311.32 317.72 323.94 329.54 334.35 338.42];
Area = [0.72 1.28 2 2.88 3.92 5.12];
hv = linspace(min(h), max(h), 6);
Toutv = linspace(min(Tout), max(Tout), 8);
[H,T] = ndgrid(hv,Toutv);
A = griddata(h,Tout,Area, H,T, 'nearest');
figure
mesh(H, T, A)
grid on
The vector sizes for ‘hv’ and ‘Toutv’ are arbitrary, so make them whatever lengths you want The 'nearest' method is the only one that will work with your data.
.

この質問は閉じられています。

質問済み:

2020 年 4 月 12 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by