For large matrices, the second method is much slower than the other two. The advantage of bsxfun is that it can handle many kinds of matrix operations that backslash cannot handle. Sparse matrices are discussed in Chapter 18.

6 M-Files Most of the examples you have typed in so far are short. For solving more complex problems, you need to create a sequence of statements stored in a file so that you can easily edit and re-use them. These are called M-files because they must have the file type .m as the last part of their filename.