Efficient Coding Using Vectorization Technique

After studying this chapter, you should be able to:

  • Learn vectorization technique
  • Convert loops into vectorized codes
  • Learn techniques for faster computations
  • Design efficient codes using vectorization technique

9.1 Introduction

MATLAB® is commonly used in several engineering and scientific disciplines where large scale numerical calculations are involved. Sometimes programs may take days to execute. Therefore, it is important to learn how to write such programs efficiently so that they can run in hours or even minutes. MATLAB programs are interpreted, that is, each statement is executed at the command prompt independently of others, and there is no separate binary image generated as in compiled ...

Get Programming in MATLAB ® now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.