Draw the minimal value from the plot

Let assume we have plot of some function (actually we have plot of the function-values at some sample points). Is it possible to get the minimal function-value from this plot?
Update (better description): I have figure (.fig file) of the plot of some function and I would like to obtain the minimal function-value from the plot in this figure.
Currently I am trying something like that: fighandler = openfig( inName ); yData = get( fighandler, 'YData' );
However, it doesn't work.

 채택된 답변

Paulo Silva
Paulo Silva 2011년 3월 23일

1 개 추천

h=plot(0,0); %any plot will do
ydata=get(h,'YData');
min(ydata)
%draw a horizontal line with y that minimum
line(get(gca,'Xlim'),[min(ydata) min(ydata)])

댓글 수: 3

Mateusz
Mateusz 2011년 3월 23일
Thanks, but what if I have only figure (file with .fig extension).
I am trying the following:
fighandler = openfig( inName );
yData = get( fighandler, 'YData' );
but it doesn't work.
Paulo Silva
Paulo Silva 2011년 3월 23일
the figure itself doesn't contain ydata, you must look for it
try this:
get(get(gca,'children'),'Ydata')
Mateusz
Mateusz 2011년 3월 23일
It works, thanks.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Environment and Settings에 대해 자세히 알아보기

질문:

2011년 3월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by