MATLAB Answers


Bathymetric data into a surface plot

Asked by Ruari Skinner on 16 Feb 2019
Latest activity Commented on by Star Strider
on 16 Feb 2019
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


Sign in to comment.

1 Answer

Answer by Star Strider
on 16 Feb 2019
 Accepted Answer

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.


My code runs without error with the data you provided as ‘Bathymetric data (XYZ).xlsx’. Use it and the xlsread call I used.
I have no idea what the problem could be with your code, or your implementation of my code, since you didn’t post it.
Sorry I had simple spelling error.
Thank you for your support and quick responce, much appreciated.
My pleasure.
If my Answer helped you solve your problem, please Accept it!

Sign in to comment.