Chapter 5. Logical Vectors

This chapter introduces a most powerful and elegant feature of MATLAB, logical vectors. The topic is so useful and hence important that it deserves a chapter of its own.

As an exercise, enter the following statements on the command line:

   r = 1;
   r < = 0.5 % no semi-colon

If you correctly left out the semicolon after the second statement, you will have noticed that it returned the value 0. Now enter the expression r > = 0.5 (again, no semicolon). It should return the value 1. We already saw in Chapter 2 that a logical expression ...

Get Essential MATLAB for Engineers and Scientists Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.