**This is an old revision of the document!** ----
====== Math 445 lecture 7 diary: functions, if statements ====== The simplest way to define you own function in Matlab is to write it in a text file whose filename matches the function name, with a '.m.' suffix. For example, we can define a ''faren2celsius'' function by creating a text file ''faren2celsius.m'' with the following contents <code matlab> function tempC = faren2celsius(tempF) % convert celsius temperature to farenheit ('help string') % input argument tempC % output value tempF tempC = 5/9*(tempF-32); % semicolon to suppress printing end </code>