필터 지우기
필터 지우기

Plot a vertical ligne from the maximum of a function

조회 수: 4 (최근 30일)
boureghda mohammed
boureghda mohammed 2016년 12월 2일
답변: Image Analyst 2016년 12월 2일
Hi, Let say that I have a function f(x) and x=[x1,x2,...,xn] the values that can x take it, so for example if f(x) reach a maximum at x5. How can I plot a vertical line from the maximum point in the plot of the function f(x) to x5 in x axis.

답변 (1개)

Image Analyst
Image Analyst 2016년 12월 2일
Assuming x5 is the index of your vector "f" where the line should be drawn, try this:
[yMax, xMax] = max(f); % xMax is an integer index 1,2,3, or 4,.....not a floating point value.
yl = ylim();
line([xMax, xMax], [yl(1), yMax], 'Color', 'b', 'LineWidth', 2);
grid on;

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by