User Tools

Site Tools


gibson:teaching:fall-2014:math445:lecture7-diary

This is an old revision of the document!


A PCRE internal error occured. This might be caused by a faulty plugin

====== 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>

gibson/teaching/fall-2014/math445/lecture7-diary.1412705393.txt.gz · Last modified: 2014/10/07 11:09 by gibson