plot(X,Y,Z​,Data(temp​erature))

How can I plot the spatial points in matlab for the temperature? the file is -- X,Y,Z,temperature

2 Comments

Do your X and Y form a regular grid, with one Z for each X and Y combination, and a temperature associated with that X, Y, Z ? This is the easiest of the situations.
Are your X and Y scattered, with only one Z for any given X, Y combination, and a temperature associated with that X, Y, Z? This is not difficult but a bit more work than the first possibility.
Do your X, Y, Z form a volume? If so is it a regular volume like a cuboid? The difficulty of volume work depends upon the kind of plot needed.
Do your X, Y, Z just form a point cloud? This can be the most difficult to get useful plots out of.
the first one

Sign in to comment.

Answers (2)

In the case of rectangular grids of X, Y, with a Z corresponding, and a temperature for each location, then the easiest way is to reshape() the X, Y, Z, Temperature into 2D arrays so that the unique values of the X occupy either the rows or the columns, and the Y have the unique values going in the other direction. Once you have that arrangement, then
surf(xgrid, ygrid, zgrid, temperaturegrid)

4 Comments

Sorry, but I have a similar problem. What would your code look like to reshape the 3D temperature array into 2D slices? Thanks in advance!
A 3-D array already has slices. The third dimension is the slice. So what do you mean? Do you mean like you want a tall or wide array where all the slices are stitched together vertically or horizontally? Please explain what "reshape" means to you -- what is your desired output?
Sorry, I'm still learning how to use Matlab, but I have a 4-D matrix that contains temperature values in x y and z, as well as a function of time. My main objective is to be able to plot an animation of the 3D temperature values in x y and z as my time variable increases, but my first step would be to learn how to plot the temperature in three dimensions.
This may be redundant, but essentially I'm trying to plot my discrete values of temperature in a 3D graph.
Here's a link to my question with more detail:
Thank you in advance for your help!

Sign in to comment.

Image Analyst
Image Analyst on 25 Apr 2018
Another way is to use scatter3() and adjust the color and/or size of the marker depending on the temperature of the 3-D point. This would not be good though if you had a solid volume, like every possibility of x, y, and z has a temperature. If you have that, you might try the Volume Viewer app on the Apps tab of the tool ribbon, if you have the Image Processing Toolbox. Or you can view slices through the volume with slice() for older versions of MATLAB.

Categories

Asked:

on 25 Apr 2018

Commented:

on 4 Jul 2020

Community Treasure Hunt

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

Start Hunting!