Use interpolation to align two time series onto the same time vector.
This is a problem that comes up in Trendy whenever you want to do mathematical operations on two trends (see for example the Ramen-to-Sushi Index).
Given two time series defined by the vector pairs (t1,d1) and (t2,d2), come up with a single new time vector tn such that (tn,d1n) and (tn,d2n) form consistent vector pairs.
Specifically, the new time vector should extend only to portions covered by both series (i.e. no extrapolation). Within this common interval, tn should contain all the time points from both time vectors. With this new time basis, use linear interpolation to generate two new data series.
Example 1:
t1 = [1 3 5] d1 = [2 4 2] t2 = [2 4] d2 = [1 5]
tn = [2 3 4] d1n = [3 4 3] d2n = [1 3 5]
Example 2:
t1 = [1 2 3 4 5] d1 = [2 3 5 6 3] t2 = [2 3.5 4 4.5 5 6] d2 = [3 9 8 2 0 1]
tn = [2 3 3.5 4 4.5 5] d1n = [3 5 5.5 6 4.5 3] d2n = [3 7 9 8 2 0]
What is the distance from point P(x,y) to the line Ax + By + C = 0?
165 Solvers
399 Solvers
Reverse the elements of an array
449 Solvers
Create a two dimensional zero matrix
243 Solvers
171 Solvers
Opportunities for recent engineering grads.
Apply Today