フィルターのクリア

x,y,z plot and temperature

16 ビュー (過去 30 日間)
Michela Longhi
Michela Longhi 2017 年 12 月 12 日
コメント済み: Michela Longhi 2017 年 12 月 13 日
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.

採用された回答

Honglei Chen
Honglei Chen 2017 年 12 月 12 日
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
  1 件のコメント
Michela Longhi
Michela Longhi 2017 年 12 月 13 日
Thank you for the answer!

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2017 年 12 月 12 日
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 件のコメント
Michela Longhi
Michela Longhi 2017 年 12 月 13 日
Thank you for the great example!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by