Bathymetric data into a surface plot
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
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
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)
