9

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