Minimum positiver real number.

Hi, How do you find the minimum poositive real number for example d=[73 -1.07 1.08 0.01]
i want 0.01 min(d) gives -1.07

 采纳的回答

Use logical indexing first:
>> d = [73 -1.07 1.08 0.01];
>> min(d(d>0))
ans =
0.01

3 个评论

Thinking of it is there a way to find a second highest number like for this case 1.08
Try sorting:
d = [73 -1.07 1.08 0.01];
sorted_d = sort(d(d>0), 'descend')
secondHighest = sorted_d(2)

请先登录,再进行评论。

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 Operating on Diagonal Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by