Copy of my matlab script I wrote to anayze the loading on a circular shaft and display shear and bending moment diagrams, stress at all points of interest, and Factor of Safety. See "template" and "example".
It is still a bit of a work in progress as I am working on getting it to be functional for beams of different cross sections, and for applied distributed loads.