sort the values in a vector h(n)

1 回表示 (過去 30 日間)
ad lyn
ad lyn 2021 年 12 月 30 日
コメント済み: Voss 2021 年 12 月 30 日
with :
h(n)=[0.00275644015144904,0.00355792817060437,-0.00242358119135895,0.00221119427549373,-0.00231180739987265,0.0020388846972871]

採用された回答

Voss
Voss 2021 年 12 月 30 日
Look into sort and abs.
h=[0.00275644015144904,0.00355792817060437,-0.00242358119135895,0.00221119427549373,-0.00231180739987265,0.0020388846972871]
h = 1×6
0.0028 0.0036 -0.0024 0.0022 -0.0023 0.0020
sort(h)
ans = 1×6
-0.0024 -0.0023 0.0020 0.0022 0.0028 0.0036
sort(h,'descend')
ans = 1×6
0.0036 0.0028 0.0022 0.0020 -0.0023 -0.0024
sort(abs(h))
ans = 1×6
0.0020 0.0022 0.0023 0.0024 0.0028 0.0036
sort(abs(h),'descend')
ans = 1×6
0.0036 0.0028 0.0024 0.0023 0.0022 0.0020
  4 件のコメント
ad lyn
ad lyn 2021 年 12 月 30 日
編集済み: ad lyn 2021 年 12 月 30 日
if As=[2,98,77777,565,-45885]
how to verify if i is included in As?
Voss
Voss 2021 年 12 月 30 日
ismember(i,As)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by