Stuart’s MATLAB Videos

Watch and Learn

Basics: Implementing a formula in MATLAB

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.
  • print
  • send email


To leave a comment, please click here to sign in to your MathWorks Account or create a new one.