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 Kommentar

Cris LaPierre
Cris LaPierre am 12 Apr. 2020
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?

Antworten (1)

Star Strider
Star Strider am 12 Apr. 2020

0 Stimmen

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.
.

Diese Frage ist geschlossen.

Gefragt:

am 12 Apr. 2020

Geschlossen:

am 20 Aug. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by