So I am supposed to write a code that does the following below. I am in a beginners C++ course and am looking for help in terms of starting. I do not want anyone to write the code down, but a few step by step instructions would be great on where to go with it!!
Many properties in engineering and science can be analyzed by trying to fit a straight line which uses x as the independent variable and y as the dependent variable. You have an array of x values and a corresponding array of y values. Create the process to fit a straight line to the data. Using the y = mx + b, where m is the slope and b is the y intercept, m can be calculated by the formula
(Σx * Σy - n Σ(x * y))/((Σx)2 – n Σ(x)2 )
where n is the number points and b is given by
(Σy – slope * Σx)/n
where n is again the number of points.