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