Hi there, I am relatively new to matlab and am using it for a very important project. I am hoping to use a .grd file to plot a topographic map of a major fault in Turkey and some data (my results) over it. However, I am really struggling to plot the .grd file in Matlab - I have tried grdinfo2 and grdread2 but i keep getting errors.
I have tried youtube and looking on here for relevant documentation but can't get anything to work. If anyone would be so kind as to help/ advise it would be very much appreciated.
Many thanks

댓글 수: 5

Walter Roberson
Walter Roberson 2019년 2월 24일
I had no difficulty using grdread2() with that file.
P_L
P_L 2019년 2월 25일
Hi Walter, thank you for replying. I believe I couldn't get it to work because i was trying to call the function from another script that was in the same directory.
I have successfully ran the script now at the command line and I have X,Y,Z data (Lat,Lon and depth). I tried using pcolor(Y,X,Z) but all I am seeing is a black square.
Is there anything you can recommend to plot this correctly?
Many thanks NAFZ.jpg
Walter Roberson
Walter Roberson 2019년 2월 25일
I used
[X, Y, Z] = grdread2('FileNameWasHere.grd');
surf(X, Y, Z, 'edgecolor', 'none');
You could
[X, Y, Z] = grdread2('FileNameWasHere.grd');
h = pcolor(X, Y, Z);
h.EdgeColor = 'none';
When you have a high enough density of data in an axes, then the black edge between cells can end up turning the whole graph black, because it is fixed width but the cell sizes gets smaller to fit in the axes.
P_L
P_L 2019년 2월 25일
편집: P_L 2019년 2월 25일
Hi Walter, thanks again for getting back to me!
I have another question if you'd be so kind to help.. I am now trying to plot my data on top of the topography as mentioned before. I have used the function shadem to colour it correctly and now my data points for my stations get 'lost' in the topography. They show up fine when i don't use 'shadem' however, the quality of the topography is too poor my project. 1) Is there a way to stop my data points from getting lost?
Many thanks
h = pcolor(X,Y, Z);
shading interp
h.EdgeColor = 'none';
xlabel('Longitude (deg, E)');
ylabel('Latitude (deg, N)')
shadem('phong')
%axis([30 30.1 40 41.1 10.9 0 2500])
hold on
% plot for stations
load station_location.txt
latitude= station_location(:,1);
longitude= station_location(:,2);
elevation= station_location(:,3);
% plot them
plot(longitude,latitude,'^','MarkerSize',5,'MarkerFaceColor', [0.6350 0.0780 0.1840])
Walter Roberson
Walter Roberson 2019년 2월 28일
shadem() would be for the Mapping Toolbox; some of the routines you are using such as plot() are not appropriate if you are working with a mapping axes. If you are using a mapping axes then you should use surfm() instead of pcolor(), and plotm() instead of plot()

댓글을 달려면 로그인하십시오.

 채택된 답변

KSSV
KSSV 2019년 2월 25일
편집: KSSV 2019년 2월 25일

0 개 추천

pcolor(Y,X,Z)
shading interp

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Mapping Toolbox에 대해 자세히 알아보기

질문:

P_L
2019년 2월 24일

댓글:

2019년 2월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by