How to find the best point (of intersection) of 3 contour lines?
조회 수: 11 (최근 30일)
이전 댓글 표시
I have made 3 contour maps using the values in data file attached. The 3 contour lines, with values 7.54, 42.38 and 33.46 (as shown in the plot), are intersecting with each other but not altogether. Is there a way to find a common point (with x-y coordinates) which can be called as the intersection of these 3 lines? Your help will be much appreciated. Thank you
load data
contourf(x1,y1,z1, [900 7.54] ,'ShowText','on',FaceAlpha=0.2,EdgeAlpha=0.5,EdgeColor='r');
% 900 value I have input as a dummy value, as when I use only one value, it
% does not show correct contour.
hold on
contourf(x1,y1,z2, [900 42.38] ,'ShowText','on',FaceAlpha=0.2,EdgeAlpha=0.5,EdgeColor='g');
contourf(x1,y1,z3, [900 33.46] ,'ShowText','on',FaceAlpha=0.2,EdgeAlpha=0.5,EdgeColor='b');
grid on
plot(114,135,'x','color','r') % this point is only for demonstration
댓글 수: 3
John D'Errico
2023년 6월 8일
편집: John D'Errico
2023년 6월 8일
There is no "best" point. Only you can define that. And once you do define what "best" means, then you can START to find a solution. Until then, best is meaningless. Effectively, you cannot even start to write code until you define what the code should do.
You say you are "aiming along the lines of weighted mean". I'm sorry, but this is still a meaningless statement. A weighted mean of what? Where would weights come from in this context?
There is a set of infinitely many points delineated by those contour lines. That set is not even a simple convex set. Certainly not even a triangular region. It is just a region in the plane. Any point inside that region could arguably be identified as best.
And for example, you might pick the centroid of the region. But if a region is not convex, then the centroid need not even be inside the region. (Consider a U-shaped region, and it need not even be that dramatically shaped. Even something that looks like a half moon would qualify as one where the centroid is not contained inside the region itself.)
I'm sorry, but the simplest solution is to just pick the point that makes sense to you. Click with your mouse at a point that makes you happy. That will be as good as any other measure we could offer.
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Contour Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!