MATLAB Answers

Bathymetric data into a surface plot

115 views (last 30 days)
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.
Ruari Skinner

Accepted Answer

Star Strider
Star Strider on 16 Feb 2019
Try this:
[D,S] = xlsread('Bathymetric data (XYZ).xlsx');
Lon = D(:,1);
Lat = D(:,2);
Dep = D(:,3);
plot3(Lon, Lat, Dep, '.')
grid on
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);
mesh(X, Y, zDep)
grid on
title('Mesh Plot')
mesh(X, Y, zDep)
hold on
contour3(X, Y, zDep, 20, 'k', 'LineWidth',2)
hold off
grid on
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.
Star Strider
Star Strider on 16 Feb 2019
My pleasure.
If my Answer helped you solve your problem, please Accept it!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by