This a work in progress / running list of notes on recipes for working with Octave.
Plotting Multiple Lines in a Loop
This was a compact way to create a quick graph of muliple lines of data with one call to
plot. In this example, I loop through a range of learning rates in a gradient descent algorithm and then plot the change in cost against the number of iterations.
For each learning rate iteration, the series of cost changes is stored in a matrix. Then when all the iterations are complete, you just call
plot on the entire matrix.
A nice trick on line 13 is using the same range of values that were looped through to create the series as the input for a legend. There may be an easier way to do this, but the legend function accepts a cell array of strings as an argument, not an array of numbers. You can convert the numerical array to a cell array with num2cell and then use cellfun to convert the numbers to strings.