Indexing with logical vectors, relational operators, find, size Are the followin
ID: 3598775 • Letter: I
Question
Indexing with logical vectors, relational operators, find, size Are the following statements match to choice A or B? For example, assign an s-03 = if you think the statement (3) matches to choice A, otherwise assign ans-03 = ' B ' ' A ' , Given vec = [2 3 4 5] (1) vec ([0 11 0]) produces A. [3 4] B. Error (2) vec (logical ((011 0])) produces A. [3 4] B. Error (3) vec (logical (0 1 1])) produces A. [3 4] B. Error (4) vec (logical (I011 0 1])) produces A. [3 4] B. Error (5) vec (logical ([0 7-2 1])) produces A. [3 4 5] B. [3 5] (6) vec ([111 1]) produces A. [2 2 2 2)] B. [2 3 4 5] (7) vec (logical ([111 1]) produces A. [2 2 2 2)] B. [2 3 4 5] (8) vec (find (vec> help find, or >>doc find) A. vec (vec> doc size) A. always the same as size (vec) B. NOT always the same as size (vec) (10) size (find (vecExplanation / Answer
1.
B it will result in error as matlab do not have 0 indexing
2.
This will produce [3 4] (A)
As it says include which index in that order
3.
A. [3 4]
same as above
4.
It will give error as index 5 is not available in vec
5.
[3 4 5]
any non zero value is considered positive
6.
[2 2 2 2]
index 1 repeated 4 times
7.
[2 3 4 5]
logical includes all element
8.
vec(vec < 4)
9.
always same as size of vec
10.
Now always same as size of vec