Many properties in engineering and science can be analyzed by trying to fit a st
ID: 3757695 • Letter: M
Question
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. Suppose you have an array of x values and a corresponding array of y values. Write the process to fit a straight line to the data. Using the scenario 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.
Explanation / Answer
It can be done using the y=mx+c line equation. We can find the slope of the line by two points.
Once two points are given
m= x2-x1/y2-y1.
Based on these two points slope can be calculated and equation of the line can be determined based on this.
y-y1/x-x1 = m which is the slope of the line calculated above.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.