Simple way to fit a line to some data points using the least squares method for both straight lines, higher degree polynomials as well as trigonometric functions using Matlab or Octave. (Solution for overdetermined systems)
More detailed example in experimental data with the photoelectric effect to work out Planck's constant, work function and threshold frequency:
https://www.dropbox.com/sh/1th16dcqpc...