Now that we are familiar with script files we are going to move on to look at who we can write functions in MATLAB, and how they differ from scripts.

The following video will help you here.

Video 4: Functions in MATLAB

Using the scripts that you write to calculate the volumes of a sphere and cone as starting points, can you write two functions that carry out the same tasks? The sphere function should only need one input (or argument) but the function for the cone needs two arguments. Save these functions and bring them along to the lab with the scripts produced earlier.

Last modified: Saturday, 8 August 2020, 10:17 PM