You can fit a function to a line in MATLAB using the "lsqcurvefit" function or the "polyfit" function.
Using lsqcurvefit:
main.m532 chars27 lines
Using polyfit:
main.m512 chars25 lines
Both methods will fit a line (in the form y = ax + b
) to the given data points.
gistlibby LogSnag