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 天)
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.

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 CenterFile Exchange 中查找有关 Logical 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by