109 views (last 30 days)

Show older comments

Hello,

I have collected data of temperature measurements at certain coordinates in a room. I want to plot these temperature measurements on a contour map, where the X and Y axis are the perimeter (and dimensions) of the room, and the contours of Z are the temperature measurements I have taken. The total size of the room is x=7m, and y=10.6m. I cannot find a way of plotting a contour map where Z is not a function of x or y. The measurements of temperature (Z) at certain x- and y-coordinates in the room are shown below:

Coordinates Temperature

X Y Z

0.2 9.4 17.0

2 9.3 17.85

7 5 17.65

7 5 17.5

Is there a way of plotting this on a 2D contour map, where the values of Z are shown on the contours?

Aquatris
on 4 Jan 2019

Edited: Aquatris
on 7 Jan 2019

You do not have a lot of data so the countour map will not look great. However what you need to do is;

% create data

x = [0.2 2 7 7];

y = [9.4 9.3 5 5];

z = [17 17.85 17.65 17.5];

% create xy axis grid

[X,Y] = meshgrid(x,y);

% create corresponding Z values, assume z = 0 for locations with no z data

Z = zeros(length(x),length(y)) ;

for i = 1:length(x)

for j = 1:length(y)

if i==j % z data exist for only for x(n) y(n) location, n = 1,2,3...

Z(i,j) = z(i);

end

end

end

contourf(X,Y,Z)

Walter Roberson
on 2 Jul 2020

You should probably be using scatteredInterpolant() or griddedInterpolant().

Vidya shree V
on 24 Sep 2020

I have R Z T value how to plot contour graph in matlab

ASHUTOSH KUMAR SINGH
on 1 Oct 2020

Hello Walter, I have a data consisting of a X,Y coordinate and values of force data which I want to be on Z.I want to plot a 3d plot (a surface plot)

But the X, Y are Z data are not equal and almost no relation between the (X,Y) and Z. I have attached the excel sheet. Thank you in advance.

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

Start Hunting!