Dear all,
I have a surface plot that represents the bathymetry of a given surface:
x=longitute;
y=latitude;
z=depth;
Now, I want to obtain a section that cuts this surface at the latitude (37.9º) in order to obtain something like the following figure:
How can I do this?
Thanks in advance.

댓글 수: 2

DGM
DGM 2021년 6월 30일
편집: DGM 2021년 6월 30일
The example image isn't a section. It simply appears to be the same surface from a 2D view, like
shading flat % get rid of edges
view([0 -1 0]) % set 2D view looking toward +y
Either that, or it represents some sort of difference information.
If you actually want a section, it will just be a line. If the query point where you want to make the section belongs to the x,y points you're using, then all you have to do is extract the corresponding vector from the Z data. If it lies between the plotted points, then you'll have to interpolate.
Yes you are rigth, the second image is not a section.
I really want a section that will be represented by a single line. The problem is that i don't know how to extract that data.
Thanks

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

 채택된 답변

KSSV
KSSV 2021년 7월 1일

0 개 추천

Check this demo example, may be useful.
[X,Y,Z] = peaks(100) ;
surf(X,Y,Z)
xi = unique(X(:)) ;
val = 0; dx = 10^-3 ; w = 10 ;
yi = linspace(val-dx,val+dx,w) ;
[Xi,Yi] = meshgrid(xi,yi) ;
Zi = interp2(X,Y,Z,Xi,Yi) ;
surf(Xi,Yi,Zi)

댓글 수: 4

Thank you,
But what I need is only a single line and not a surface.
[X,Y,Z] = peaks(100) ;
surf(X,Y,Z)
xi = unique(X(:)) ;
val = 0; dx = 10^-3 ; w = 10 ;
yi = repmat(val,size(xi)) ;
zi = interp2(X,Y,Z,xi,yi) ;
scatter3(xi,yi,zi,[],zi)
DGM
DGM 2021년 7월 1일
편집: DGM 2021년 7월 1일
Or instead of scatter3(), just
plot(xi,zi)
if you don't need the color mapping and want a plain 2D solid line.
or
h = surf([xi(:) xi(:)],[yi(:) yi(:)],[zi(:) zi(:)]);
set(h,'facecolor','none','edgecolor','interp');
set(h,'linewidth',3); % make it fat so it's easier to demonstrate
view([0 -1 0]); % only show 2-D view
colormap(parula);
If you want the solid line with colormapping.
The 2D view enforcement works with scatter3() too.
Thank you! It works perfectly

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

추가 답변 (0개)

카테고리

제품

질문:

2021년 6월 30일

댓글:

2021년 7월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by