1.1 Given two points with co-ordinates (r1,y1) and (x2,y2), there is a unique straight line connecting them of the form y = mx + c, where m is the gradient and e is a constant. Write down expressions for the coefficients, m and c, in terms of the co-ordinates of the points. This is lingar internolation

Calculus For The Life Sciences
2nd Edition
ISBN:9780321964038
Author:GREENWELL, Raymond N., RITCHEY, Nathan P., Lial, Margaret L.
Publisher:GREENWELL, Raymond N., RITCHEY, Nathan P., Lial, Margaret L.
Chapter2: Exponential, Logarithmic, And Trigonometric Functions
Section2.CR: Chapter 2 Review
Problem 111CR: Respiratory Rate Researchers have found that the 95 th percentile the value at which 95% of the data...
icon
Related questions
Question

8.1

Imagine you have a table of data (x;, Y:) but you need to estimate values between those
specific points. The data might be growth rates, chemical reaction rates, profits or even exper-
imental data.
Thus you require an approximate function y(x) at for x values in the range covered by the x;
values provided. We can use an interpolation scheme to estimate values for y for intermediate
values of x that are between values listed in the table.
1.1 Given two points with co-ordinates (x1,y1) and (x2,y2), there is a unique straight line
connecting them of the form y = m + c, where m is the gradient and c is a constant. Write
down expressions for the coefficients, m and c, in terms of the co-ordinates of the points. This
is linear interpolation.
1.2 Write a float function called interpolate that takes two pairs of float coordinates and
an intermediate x value (a total of 5 float arguments: x1, yl, x2, y2 and x). The function
should return a y value based on the straight line fit of the points. Incorporate your function
into a file interp.cpp.
Consider if your function needs to check the input values in any way and add any checking
you consider necessary.
1.3 Testing: Write a short main function in a file called testinterp.cpp to test your
function. Note that you will need a Makefile that is able to combine the two files interp.cpp
and testinterp.cpp to generate the test program: testinterp.
Have your program print out (using cout) what your interpolate function returns. Run
your program for the following point and report the values:
(x1,y1)=(1, 8.57), (x2,y2)=(2, 10.28) and an r value of 1.25.
Transcribed Image Text:Imagine you have a table of data (x;, Y:) but you need to estimate values between those specific points. The data might be growth rates, chemical reaction rates, profits or even exper- imental data. Thus you require an approximate function y(x) at for x values in the range covered by the x; values provided. We can use an interpolation scheme to estimate values for y for intermediate values of x that are between values listed in the table. 1.1 Given two points with co-ordinates (x1,y1) and (x2,y2), there is a unique straight line connecting them of the form y = m + c, where m is the gradient and c is a constant. Write down expressions for the coefficients, m and c, in terms of the co-ordinates of the points. This is linear interpolation. 1.2 Write a float function called interpolate that takes two pairs of float coordinates and an intermediate x value (a total of 5 float arguments: x1, yl, x2, y2 and x). The function should return a y value based on the straight line fit of the points. Incorporate your function into a file interp.cpp. Consider if your function needs to check the input values in any way and add any checking you consider necessary. 1.3 Testing: Write a short main function in a file called testinterp.cpp to test your function. Note that you will need a Makefile that is able to combine the two files interp.cpp and testinterp.cpp to generate the test program: testinterp. Have your program print out (using cout) what your interpolate function returns. Run your program for the following point and report the values: (x1,y1)=(1, 8.57), (x2,y2)=(2, 10.28) and an r value of 1.25.
Expert Solution
steps

Step by step

Solved in 4 steps

Blurred answer
Similar questions
Recommended textbooks for you
Calculus For The Life Sciences
Calculus For The Life Sciences
Calculus
ISBN:
9780321964038
Author:
GREENWELL, Raymond N., RITCHEY, Nathan P., Lial, Margaret L.
Publisher:
Pearson Addison Wesley,
Algebra & Trigonometry with Analytic Geometry
Algebra & Trigonometry with Analytic Geometry
Algebra
ISBN:
9781133382119
Author:
Swokowski
Publisher:
Cengage
College Algebra
College Algebra
Algebra
ISBN:
9781938168383
Author:
Jay Abramson
Publisher:
OpenStax
Glencoe Algebra 1, Student Edition, 9780079039897…
Glencoe Algebra 1, Student Edition, 9780079039897…
Algebra
ISBN:
9780079039897
Author:
Carter
Publisher:
McGraw Hill
College Algebra
College Algebra
Algebra
ISBN:
9781305115545
Author:
James Stewart, Lothar Redlin, Saleem Watson
Publisher:
Cengage Learning
Trigonometry (MindTap Course List)
Trigonometry (MindTap Course List)
Trigonometry
ISBN:
9781337278461
Author:
Ron Larson
Publisher:
Cengage Learning