フィルターのクリア

how to display a maximum and minimum value in figure of Matlab?

246 ビュー (過去 30 日間)
SimTec
SimTec 2022 年 1 月 19 日
回答済み: Ankit 2022 年 1 月 19 日
I would like to show the max and minimum value of a graph in Matlab figure

採用された回答

Ankit
Ankit 2022 年 1 月 19 日
text: Add text descriptions to data points
e.g. text(x,y,str) adds a text description to one or more data points in the current axes using the text specified by str.
Read more about text
min/max function to obtain the min/max value of variable.
X = 0:0.1:1;
Y = exp(X);
[ymin,idx_min] = min(Y) ;
[ymax,idx_max] = max(Y) ;
plot(X,Y)
hold on
text(X(idx_min),ymin,['ymin: ' num2str(ymin)]);
text(X(idx_max),ymax,['ymax: ' num2str(ymax)]);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by