Create a meshgrid on a 3d plot
3 views (last 30 days)
Show older comments
Hello,
I have plotted a 3D graph representing a subducting slab. The 3 dimensions are: longitude, latitude and depth.
figure(1) %plot en longitude, latitude, et depth
tri = delaunay(lon,lat);
trimesh(tri,lon,lat,depth);
I'd like to add on it a random triangular mesh grid in black only for specific coordinates : longitude between 273 and 277, latitude between 9 and 12 but most importantly depth from 0 to -50.
Do you have an idea of how I could do that?
Thank you for your help
0 Comments
Answers (1)
BhaTTa
on 14 Aug 2025
% Simple dummy data initialization
lon = 270 + 15*rand(500,1); % 500 random longitude points
lat = 5 + 15*rand(500,1); % 500 random latitude points
depth = -200*rand(500,1); % 500 random depth points (negative)
% Your original plot
figure(1)
tri = delaunay(lon,lat);
trimesh(tri,lon,lat,depth);
hold on;
% Add random mesh in specified region
n_points = 80;
rand_lon = 273 + 4*rand(n_points,1); % 273-277
rand_lat = 9 + 3*rand(n_points,1); % 9-12
rand_depth = -50*rand(n_points,1); % 0 to -50
tri_random = delaunay(rand_lon, rand_lat);
trimesh(tri_random, rand_lon, rand_lat, rand_depth, 'EdgeColor', 'k', 'FaceColor', 'none');
xlabel('Longitude'); ylabel('Latitude'); zlabel('Depth');
hold off;
0 Comments
See Also
Categories
Find more on Geographic Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!