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
採用された回答
Star Strider
2019 年 2 月 16 日
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 件のコメント
Ruari Skinner
2019 年 2 月 16 日
Thankyou,
I will try this and get back to you.
Star Strider
2019 年 2 月 16 日
My pleasure.
Ruari Skinner
2019 年 2 月 16 日
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);
Star Strider
2019 年 2 月 16 日
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.
Ruari Skinner
2019 年 2 月 16 日
Sorry I had simple spelling error.
Thank you for your support and quick responce, much appreciated.
Ruari
Star Strider
2019 年 2 月 16 日
My pleasure.
If my Answer helped you solve your problem, please Accept it!
Guilherme de Melo
2023 年 9 月 22 日
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
2023 年 9 月 22 日
@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!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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)
