MATLAB: Plotting 4D with 3 vectors and 1 matrix

4d plot4d plottingplotting

Hello,
I am solving a problem where I have three vectors (one for each 3D dimension), with different lengths and unevenly spaced, and a temperature matrix where each entry corresponds to the temperature at the position (x(i),y(j),z(k)). My goal is to make a 4D plot where the forth dimension (temperature) is represented my a colour (see attached file).
I have searched for an answer but did not get any solution for the conditions that I presented (3 vectors with 1 matrix). What function or approach would you recommend me to try?
*Data type*
length of x = M
length of y = N
length of z = P
size of Temperature matrix = M x N x P
Thanks in advance.

Best Answer

You can create a scattered interpolant and then sample it along grids. But as is hinted in your image, the outside is going to hide the inside when you plot. You can work with a voxel viewing routine or you can create isosurfaces to try to deal with that.