필터 지우기
필터 지우기

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 CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by