Write your code like this:
f = str2func(lower(wave));
title(wave + ' Periodic Wave')
Then highlight the word "Sawtooth" (including the quotation marks) and choose "Control" -> "Drop Down".
What you should see is this:
Now right-click on the drop-down and choose "Configure Control". You can add your additional strings there. "Item labels" is what users of the drop-down will see, and the "Item values" is the code that will be used. Make sure to include double-quotes in the "Item values".
Now when you pick a different item from the drop-down, your code will re-run with the chosen function.
Note: This will work for "Square" and "Sawtooth", but rectangle is a function in MATLAB that serves a different purpose (drawing rectangles in figures), so you would need to write your own implementation of that (and give it a different name, to avoid conflicting with the existing rectangle function), and triangle is also not a function, so you would need to write that.