필터 지우기
필터 지우기

find nearest value on mesh grid under certain contour

조회 수: 3 (최근 30일)
Katherine Zheng
Katherine Zheng 2022년 9월 3일
댓글: Bruno Luong 2022년 9월 4일
I have a surf matrix (colormap gray), a contour matrix (red). The magenta points are local minmum in red contours. I want to find the closest z value on the neigbhourhood contours. Is there any way to achieve this?
  댓글 수: 7
Katherine Zheng
Katherine Zheng 2022년 9월 4일
The value is my priority concern then the distance.
Bruno Luong
Bruno Luong 2022년 9월 4일
For each magenta point do you want to find the z value on the contour that enclosed the point? If the pointt is the locall minima, meaning that do you want to find the lowest Z along the contour?

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

답변 (1개)

Chunru
Chunru 2022년 9월 4일
load(websave("matlab.mat", "https://www.mathworks.com/matlabcentral/answers/uploaded_files/1116160/matlab.mat"))
% whos
surf(Xi2,Yi2,Zi2-max(Zi2(:)));
axis tight; title('m-min y-max')
colormap(gray); colorbar; %daspect([1 1 5]);
hold on
% red contour
surf(Xi2,Yi2,B2,'EdgeColor','r')
% peak and valley points
scatter3(Xi2(regmin),Yi2(regmin),Zi2(regmin),'mo','filled','sizedata',40)
scatter3(Xi2(regmax),Yi2(regmax),Zi2(regmax),'yo','filled','sizedata',40)
idxB2 = ~isnan(B2); % B2 has values of 0 and nans
% The values along the countour
Xc = Xi2(idxB2);
Yc = Yi2(idxB2);
Zc = Zi2(idxB2);
% These are values along the countour
[Xc Yc Zc]
ans = 727×3
1.3480 1.4440 0.0439 1.3480 1.4920 0.0357 1.3480 1.5160 0.0349 1.3480 1.6240 0.0122 1.3480 1.6480 0.0194 1.3480 1.6720 0.0230 1.3480 1.7560 0.0306 1.3480 1.7920 0.0192 1.3480 1.8160 0.0011 1.3480 1.8520 -0.0082

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by