Introducing Functions

Contents

Step 1:

Matlab's help on this is really good, so go here and read the sections:

Step 2:

Try some problems:

Problem 1: Write a function that takes a vector as an argument and returns the next-to-last element.

Problem 2: Write a function that takes two arrays as arguments and returns the maximal value contained in either array.

Problem 3: Write a function that takes two arrays as arguments and returns both the maximal and minimal values contained in either array.