Arrays combination

Given
a = -5:1:-2
b = [-12, 0, -3, -6]
c = 0:-2:-7
What answer will the following commands produce in Matlab?
(a < b) & (a < c)
(b > c) | (a < c)
(b ~= c) | 1
~(b > c) & ( a > b)
(~c | a) & b
Show me some steps or fully explain on how to get Answers for this question.

Réponses (1)

the cyclist
the cyclist le 6 Avr 2011

3 votes

The steps are:
  1. Log in to MATLAB
  2. Enter those commands exactly as written
  3. See what the output looks like
  4. Submit that answer to your teacher
[Feel free to ask some specific questions if you get stuck at any of those steps.]

5 commentaires

NONE NONE
NONE NONE le 6 Avr 2011
No man I did that infact I know how to do that in Matlab... I just want to know how do we get those answers. Or suppose it was a written test how will you go about it?
Sean de Wolski
Sean de Wolski le 6 Avr 2011
CTRL+C, CTRL+V in the command window. Then I'd write down the results. If you were really fancy you could use the diary function so you don't even have to write down the results. On a test, I would read the logical conditions just like MATLAB and respond accordingly. Computers are dumb, they don't think on their own, and they do EXACTLY what you tell them. This makes it very easy for us to predict what their results will be.
Walter Roberson
Walter Roberson le 6 Avr 2011
If it was a written test, then I would apply my knowledge of the effects of each of the operators and of what is calculated by "if". That knowledge has been obtained by reading the documentation about each operator.
Peter Manley-Cooke
Peter Manley-Cooke le 6 Avr 2011
Personally I would have read the stuff you are supposed to have read and just "know what the symbols mean". Sorry
NONE NONE
NONE NONE le 6 Avr 2011
ok fellows thinks for your help

Connectez-vous pour commenter.

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by