Successive points in the set (Xi, Yi) are joined by straight lines. The y co-ordinate of a point on the line joining the two points (Xi, Yi) and (Xi+1, Yi+1) with x co-ordinate X is given by This...


Successive points in the set (Xi, Yi) are joined by straight lines. The y co-ordinate of a point on the line joining the two points (Xi, Yi) and (Xi+1, Yi+1) with x co-ordinate X is given by


This process is called linear interpolation. Suppose 100 sets of data pairs are stored, in ascending order of Xi, in a text file. Write a program which will read the data and compute an interpolated value of Y given an arbitrary value of X keyed in at the keyboard. It is assumed that X is in the range covered by the data. Note that the data must be sorted into ascending order with respect to the Xi values. If this were not so, it would be necessary to sort them first. (Hint: create a class called Point that stores a single (X,Y) pair, and then create an array of Points).


Test your program on some sample data

Nov 14, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here