From 4d xyzc scater points to a surface plot
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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');
0 commentaires
Réponse acceptée
Markus
le 17 Août 2023
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])
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Scatter Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!