How can I show the max point on a plot ?

조회 수: 218 (최근 30일)
Ahmed Alhawaj
Ahmed Alhawaj 2020년 4월 18일
댓글: darova 2020년 4월 18일
I am having hard time figuring out a way to show the max point on a plot
  댓글 수: 1
darova
darova 2020년 4월 18일
Can you show the code? Did you try max function?

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

답변 (1개)

Star Strider
Star Strider 2020년 4월 18일
Depending on what you want to do, and if there is only one maximum:
x = 0:10;
y = -(x-5).^2;
[ymax,idx] = max(y); % Maximum Of Dependent Variable & Index
figure
plot(x, y)
hold on
plot(x(idx), ymax, '^r')
hold off
grid
ylim([min(ylim) max(ylim)+1])
.

카테고리

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