Question: Sometimes time-dependent data that is gathered at irregular times needs to be estimated at more regular times. For example, a remote sensor's readings might

Sometimes time-dependent data that is gathered at irregular times needs to be estimated at more regular times. For example, a remote sensor's readings might occur only at cer- tain times t=0.0, .12, .25, .37, .50, .71, 1.0 when what you want is readings at times 0.0, 0.1, 0.2, 0.3, 1.0. One way to estimate what the intermediate readings would have been is to use piecewise linear interpolation.3 For example, suppose we want to esti- mate what the reading would have been at time t = 0.2. Let f(.12) be the reading at time t = .12, and f(.25) be the reading at time t = .25. The time t 0.2 is 8/13 of the way from .12 to .25, so we can estimate the reading at t=0.2 by the weighted average 8 13. 8 (0.2) = (1 3) (.12) + (3) (.25). - = In general, to estimate the reading at time t, let a be the largest time less than t at which a reading was taken, and b be the smallest time after f at which a reading was taken. (For example, if = .36, then in the example we would have a = .25 and b = .37.) Then the estimate for the reading at t is given by === - 1(0) = (bc) 1(a) + (b a) so). (i-a) (b). f(t) Write a C++ program that does the following: 1. First, it should prompt the user for the input file name and open that file, exiting with an error message if the file can't be opened. Act 2. Then it should prompt the user for an output file name and open that file for writing, Got exiting with an error message if the file can't be opened.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
