Borrar filtros
Borrar filtros

x,y,z plot and temperature

7 visualizaciones (últimos 30 días)
Michela Longhi
Michela Longhi el 12 de Dic. de 2017
Comentada: Michela Longhi el 13 de Dic. de 2017
Hi,
I am interested in visualizing temperature distribution on a 3D plot like point.
I have a 3d path, for each point I have x,y,z coordinates for its position and corresponding temperature. the coordinates are "x" "y" "z" and the temperature "temperature".
How can I draw a 3d-plot from these x,y,z and color them with my temperature value?
Thanks.

Respuesta aceptada

Honglei Chen
Honglei Chen el 12 de Dic. de 2017
Is it something like this?
x = rand(100,1);
y = rand(100,1);
z = rand(100,1);
t = rand(100,3);
scatter3(x,y,z,20,t);
HTH

Más respuestas (1)

Image Analyst
Image Analyst el 12 de Dic. de 2017
Try this:
% Make sample parameterized curves for test data.
t = 1 : 100
x = cosd(t);
y = sind(t);
z = t/50;
minTemperature = 20;
maxTemperature = 80;
% Say that temps are random int he range of 20 to 80 degrees.
temperature = minTemperature + (maxTemperature - minTemperature) * rand(1, length(t));
% Now we have our sample/test data, and we can begin.
% First create a colormap.
numPoints = length(x);
cmap = hsv(numPoints);
% Now we need to make those temperatures into a colormap.
% First take temperatures and make it so that minTemperature is an index of 1
% and the max Temperature is an index of length(x);
minTemperature = min(temperature);
maxTemperature = max(temperature);
% Get a percentage of the way the temperatures are from max to min.
percentage = (maxTemperature - temperature) / (maxTemperature - minTemperature)
% Find the index for each temperature in the range 1 to the number of colors in our colormap.
indexes = round(percentage * (numPoints - 1) + 1);
tempColors = cmap(indexes, :);
scatter3(x, y, z, 14, tempColors, 'filled');
The color of each dot is related to what temperature it is.
  1 comentario
Michela Longhi
Michela Longhi el 13 de Dic. de 2017
Thank you for the great example!

Iniciar sesión para comentar.

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by