Bathymetric data into a surface plot
显示 更早的评论
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
采纳的回答
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 个评论
Thankyou,
I will try this and get back to you.
My pleasure.
Hi,
I am struglging to run this with an Error code stating
>> PrincessParade_bathymetry
Index in position 2 exceeds array bounds (must not exceed 1).
Error in PrincessParade_bathymetry (line 3)
Lat = D(:,2);
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.
Ruari
My pleasure.
If my Answer helped you solve your problem, please Accept it!
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
@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.)
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Map Display 的更多信息
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
