How to find the coordinate of the point on (180) contour line when y(max)?

조회 수: 3 (최근 30일)
ly
ly 2024년 1월 24일
편집: Matt J 2024년 1월 24일
How to find the coordinate of the point on (180) contour line when y(max)?
Code of the contour line:
clear
x = 0:0.1:3;
y = -2:0.1:3;
[X,Y] = meshgrid(x,y);
Z = 1000*(X.*exp(-X.^2-Y.^1));
contour(X,Y,Z,[90 180],'ShowText','on')

답변 (2개)

John D'Errico
John D'Errico 2024년 1월 24일
Easy.
  1. Use contourc to find that specific contour. It will be a piecewise linear curve.
  2. Find the point where y is maximum. That will also tell you the x coordinate at that point.
  댓글 수: 1
Stephen23
Stephen23 2024년 1월 24일
Extracting and working with the data from the CONTOURC output matrix is rather... tedious and fiddly.
There are several wrappers on FEX to make it easier to work with that data, e.g. :

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


Matt J
Matt J 2024년 1월 24일
편집: Matt J 2024년 1월 24일
You could do the calculus, or use the Symbolic toolbox to help you.
syms x y z(x,y)
z=1000*(x.*exp(-x.^2-y.^1));
G=gradient(z);
assume(x>0);
xy_max=solve([G(1)==0, z==180]), %location of max point
xy_max = struct with fields:
x: 2^(1/2)/2 y: - log((9*2^(1/2))/50) - 1/2

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by