Bathymetric data into a surface plot
80 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Ruari Skinner
il 16 Feb 2019
Commentato: Star Strider
il 22 Set 2023
Hi,
I have attached a folder which is my given bathymetric data for a seabed. I want to make this into a surface plot or a contour map. I am new to matlab and have little experience with the software, but understand that it is a good software for this particular problem.
If anyone could assit me with this, that would be great.
Thankyou,
Ruari Skinner
0 Commenti
Risposta accettata
Star Strider
il 16 Feb 2019
Try this:
[D,S] = xlsread('Bathymetric data (XYZ).xlsx');
Lon = D(:,1);
Lat = D(:,2);
Dep = D(:,3);
figure
plot3(Lon, Lat, Dep, '.')
grid on
view(35,25)
title('Exploratory Plot')
xLon = linspace(min(Lon), max(Lon), 1E+3);
yLat = linspace(min(Lat), max(Lat), 1E+3);
[X,Y] = meshgrid(xLon, yLat);
zDep = griddata(Lon, Lat, Dep, X, Y);
figure
mesh(X, Y, zDep)
grid on
view(35,25)
title('Mesh Plot')
figure
mesh(X, Y, zDep)
hold on
contour3(X, Y, zDep, 20, 'k', 'LineWidth',2)
hold off
grid on
view(35,25)
title('Mesh Plot With Contours')
This uses the griddata function to create the surface necessary to do the mesh plot. The contour3 plot draws contours. You can specify the contours you want (if you want any at all). I plotted them simply out of my own curiosity.
Experiment to get the result you want.
8 Commenti
Guilherme Weber Sampaio de Melo
il 22 Set 2023
Dear Star Strider,
I am using this your example to plot a bathymetric data mine as a 2d map colored using the depth variation. I have used the following commands to read e plot:
[X_bathy, Y_bathy, Z_bathy] = grdread2('file.grd');
[xLon, yLat] = meshgrid(X_bathy,Y_bathy);
figure(20); mesh(xLon, yLat, Z_bathy);
it is plotting but it is a 3d figure. Do you know how can I change for one map format? X and Y are in geographical coordinates in degree, and Z in meter.
I will be very thankful for you help.
Guilherme
Star Strider
il 22 Set 2023
@Guilherme Weber Sampaio de Melo — I do not have the Mapping Toolbox, so I have no experience with it or its functions. This problem used Cartesian coordinates, so I was able to work with it.
You might be able to use the view function (specifically view(0,90)) to get a ‘top-down’ view of the surface that may be map-compatible. (Also, the scatteredInterpolant function may be better than griddata for these problems, so it might be worth experimenting with it to get a more accurate representation of the surface.)
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!