...
Let's create a function to calculate the bending stress that outputs σx given (M, ri, ro ). Functions are really useful to break down your code into modules and also reuse parts of your code.
Let's first pick MATLAB's brain on how to create functions in MATLAB. Bring up the following page in the Help navigator:
...