フィルターのクリア

From 4d xyzc scater points to a surface plot

7 ビュー (過去 30 日間)
ysm ony
ysm ony 2023 年 8 月 17 日
コメント済み: ysm ony 2023 年 8 月 18 日
Hi, I have a 4d data with different lenght of dimensions. x=latitude (1xm), y=longtitude(1xn), z=height (1xh) and d=tempereture (mxnxh). d=f(x,y,z) is the value considered at these points. I'm trying to plot a surface for x,y,z points and the color is d. What I made in my code is scatter plot but I couldn't plot a surface. Can you help me, please?
clear all; close all; clc
load profileNethreed;
x=[36:1:42];
y=[26:1:45];
z=[80:10:1000];
d=profileNethreed;
[LAT,LON, HEIGHT] = meshgrid(x,y,z);
scatter3(LAT(:),LON(:),HEIGHT(:),[],profileNethreed(:),'filled');

採用された回答

Markus
Markus 2023 年 8 月 17 日
If I understood that correctly you have 3 axis (x,y,z) and a 'datacube' full of values d(x,y,z).
If you wan to pot a surface the easiest way is
surf(X,X,Z,C)
Here Z values are plottet over the XY plane and C defines to color.
Now your 4D data set is actually not one surface but 93 flat 'layers' stacked on top of each other over the XY plane so it's probably the easiest to just plot the Z layers individually. Here is a minimum example plotting your data that way:
clear all; close all; clc
load profileNethreed;
x=[36:1:42];
y=[26:1:45];
z=[80:10:1000];
d=profileNethreed;
d = permute(d,[2 1 3]); %matchning dimensions of d to the meshgrid
[LAT,LON, HEIGHT] = meshgrid(x,y,z);
for n = 1:length(z)
surf(LAT(:,:,n),LON(:,:,n),HEIGHT(:,:,n),d(:,:,n))
hold on
end
An alterntive good way of viualizing you data is imshow3D
clear all; close all; clc
load profileNethreed;
d=profileNethreed;
LOW = min(d(:), [], 'all');
HIGH = max(d(:), [], 'all');
imshow3D (d, [LOW HIGH])
  1 件のコメント
ysm ony
ysm ony 2023 年 8 月 18 日
Thank you. This is exactly what I needed.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by