This is a Matlab script to visualize the Collatz conjecture. To use, save the file and enter collatz(n), replacing n to see a graph of how many steps it takes to get back to 1 for each number from 1 to n.
Here is an example of using the collatz() function in Octave:
Octave is a nice online platform that provides much of the functionality that Matlab does and can be found at https://octave-online.net/.