find a max value in function

조회 수: 4 (최근 30일)
In Yeob Kim
In Yeob Kim 2019년 5월 22일
편집: madhan ravi 2019년 5월 22일
[x,y] = meshgrid(-2 : 0.5 : 2 , -5 : 0.5 : 5);
z = ( 5*x.^2 )+( y.^3 )+10*x;
mesh(x,y,z);
xlabel('x-axis');
ylabel('y-axis');
zlabel('z-axis');
i'm troble in this problem
i ask something this problem, present i make a 3dimension function graph
and i want find a max value , min value in z and add mark to max value , min value
please help me
i'm not good at englinsh. sorry

채택된 답변

madhan ravi
madhan ravi 2019년 5월 22일
Add the below after mesh() call:
mx = z==max(z(:));
mn = z==min(z(:));
hold on
plot3(x(mx),y(mx),z(mx),'ok')
plot3(x(mn),y(mn),z(mn),'or')
  댓글 수: 2
madhan ravi
madhan ravi 2019년 5월 22일
If you have repeated max or min use find()
mx = find(z==max(z(:)));
mn = find(z==min(z(:)));
In Yeob Kim
In Yeob Kim 2019년 5월 22일
편집: madhan ravi 2019년 5월 22일
‘ok’ ravi thanks i appreciate with your answer thanks see you again bye hahaha

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by