x = [12 54 21 36 27 19 16 78 65 43 38 91 5 8 3 18] how can i find elements of x (the values of x) such that xi<=30 and 30<=xi<=50

1 回表示 (過去 30 日間)
Waleed Alrabghi
Waleed Alrabghi 2016 年 2 月 18 日
回答済み: Jan 2016 年 2 月 19 日
x = [12 54 21 36 27 19 16 78 65 43 38 91 5 8 3 18] how can i find elements of x (the values of x) such that xi<=30 and 30<=xi<=50

回答 (2 件)

Jon
Jon 2016 年 2 月 18 日
編集済み: Jon 2016 年 2 月 18 日
Look at the find() function. You can use logical operators like < , > , and = . Just try some things and see what happens.
  2 件のコメント
Waleed Alrabghi
Waleed Alrabghi 2016 年 2 月 18 日
W = find(x<=30) is it correct ?
Torsten
Torsten 2016 年 2 月 19 日
Why not just testing it ?
Many big inventions would not have been possible without the curiosity of the people engaged in the subject.
Best wishes
Torsten.

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


Jan
Jan 2016 年 2 月 19 日
A further hint: "30<=xi<=50" might be misleading, because Matlab processes such terms from right to left. Therefore you need to connect the two relations by an and():
30 <= x & x <= 50

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by