フィルターのクリア

Find the minimum of a function on a plot and where it occurs on the x-axis

2 ビュー (過去 30 日間)
Eileen
Eileen 2022 年 2 月 10 日
コメント済み: David Hill 2022 年 2 月 10 日
So I'm new to MatLab and I have a function that's plotting temperature vs time in hours and I need to find the minimum temperature and which hour it occurs on the x-axis. Is there any way to find this using a function and only use one line of Matlab? Thank you
  1 件のコメント
David Hill
David Hill 2022 年 2 月 10 日
I would recommend fitting your data to a function (use fit() function), then finding the minium temperature would be easy. Why do you care about how many lines of code? If you just want the minimum of your discrete data then:
[Min,idx]=min(temp);
Time=t(idx);

サインインしてコメントする。

回答 (2 件)

John D'Errico
John D'Errico 2022 年 2 月 10 日
編集済み: John D'Errico 2022 年 2 月 10 日
You have a function of one variable. Perhaps you should spend some time reading about tools like fminbnd, or even fminsearch. Either of those tools would solve your probem.
In the docs for those functions, you will see examples of how they can be used.

Star Strider
Star Strider 2022 年 2 月 10 日
If the plot is of data and not of funciton evaluations, the min function could be useful.

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by