Doug Hull, MathWorks
(Originally posted on Doug's MATLAB Video Tutorials blog.)
This video will demonstrate how to implement a formula in MATLAB. In the video, we will make a function out of the formula. The function will take a scalar (single number) or a vector. We want to make the function take either a scalar or a vector so that you do not have to loop through calling the function. This is not for speed, but for the simplicity and readability of the code. This vectorization is done by means of array division ( ./ ) and array multiplication ( .* ). These operations do division and multiplication on an element by element basis.
Recorded: 27 Aug 2009