Questions tagged [linear-interpolation]

Linear interpolation is the process of approximating intermediate values given an assumption that the ranges of missing data look roughly like straight lines.

Linear interpolation is largely used for its simplicity and is typically more effective given a greater density of data. The more complex the underlying relationship of the quantities involved, the less likely linear interpolation is to provide a good value estimates.

In scientific software for statistical computing and graphics, function approx performs 1D linear interpolation.

437 questions
2
votes
2 answers

Rotate Animation speed

I want my animation to only spin for one rotation. Everytime I adjust the duration it just spins at the same speed for longer/slower. Where am I going wrong? private static final float ROTATE_FROM = 0.0f; private static final float ROTATE_TO =…
Jonno
  • 1,542
  • 3
  • 22
  • 39
2
votes
0 answers

Look up the approximate ranks of numbers not found in a vector

R> x=c(92, 3, 1, 4, 15, 4) R> rank(x) [1] 6.0 2.0 1.0 3.5 5.0 3.5 rank() can give the ranks of elements in a vector. I want to find the approximate ranks of numbers that may not be in the vector. For example, the ordered elements are R>…
user1424739
  • 11,937
  • 17
  • 63
  • 152
2
votes
0 answers

Interpolating a function over a grid with different input sizes

I have a function f(u,v,w) which I would like to interpolate using a scipy function (with linear interpolation). This is easy enough. When I run the interpolation step, I simply do the following (interpolating over a u,v,w grid): u =…
2
votes
0 answers

How to interpolate datapoints from different datasets with same interpolation points and same distance between points to calculate an average of them?

Sorry for the long question, maybe there is a quick solution but I haven't been able to figure this out. I have 3 different datasets with x and y datapoints like the following: line1_x = [277.75, 287.68, 308.77, 322.23, 342.98, 363.99, 387.59,…
2
votes
1 answer

Pandas linear interpolation for geometrical X-Y data seems to ignore points

I am trying to upsample my dataframe in pandas (from 50 Hz to 2500 Hz). I have to upsample to match a sensor that was sampled at this higher frequency. I have points in x, y, z coming from a milling machine. When I am plotting the original data the…
2
votes
1 answer

How can you use linear interpolation to impute missing time-series data?

Consider the pandas time-series, 0 NaN 1 72.0 2 63.0 3 30.0 4 26.0 5 NaN 6 NaN 7 35.0 8 NaN 9 37.0 ... the NaNs are present from where the sensor did not record the data at that time…
Evan
  • 373
  • 2
  • 3
  • 15
2
votes
2 answers

How to do linear interpolation with colors?

So I have an assignment where I have to replicate the image below using turtle. I know the basic concept of setting the pen to a color, then making a line, go 1 y coordinate down and repeat. But what I need to know is how do I know what color to…
KauDar123
  • 33
  • 3
2
votes
2 answers

Why does std::lerp not work with any type that has implemented required operations?

After learning about std::lerp I tried to use it with strong types, but it fails miserably since it only works for built in types... #include #include struct MyFloat{ float val = 4.7; MyFloat operator *(MyFloat other){ …
NoSenseEtAl
  • 28,205
  • 28
  • 128
  • 277
2
votes
1 answer

Data points falling outside the meshgrid being interpolated over, while the meshgrid certainly covers those points

I am trying to interpolate sparse data over a meshgrid, but am observing some rather odd behavior. The white dots are precisely where I have values, and I am relying on the linear interpolation algorithm to fill in the other grids where possible. I…
2
votes
1 answer

Matlab: Faster finding of 1D linear interpolation nodes and weights for each element in ND matrix

In a problem I'm working on now, I compute some values in a matrix x and I then for each element in x need to find the index of the closest element below in a monotonically increasing vector X as well as the relative proximity of the x elements to…
Fredrik P
  • 682
  • 1
  • 8
  • 21
2
votes
1 answer

How do I interpolate the value in certain data point by array of known points?

I have known data points and their values described as arrays, speed and power speed = [2, 6, 8, 10, 12] power = [200, 450, 500, 645, 820], I want to estimate the power value that corresponds to speed value (e.g. 7) that is not listed within source…
lekha
  • 39
  • 6
2
votes
1 answer

Interpolate tidy data in R

I have population data for the years: 1966, 1971, 1976. I would like to create another tidy data frame that includes the missing years (ie 1967, 1968, 1969, 1970, 1972, 1973, 1974, 1975). Linear interpolation is fine. I'm thinking approx or…
ixodid
  • 2,180
  • 1
  • 19
  • 46
2
votes
0 answers

C# 2D array interpolation

I need to interpolate whole 2d array in with c#. I managed to write an interpolation class. It should work as intpl2 function of matlab. slice: is the 2d array that going to be interpolated xaxis: interpolated x axis yaxis: interpolated y axis It…
Sugee
  • 79
  • 8
2
votes
0 answers

How to calculate/distribute weights from vertices based on a gradient

I have a list of vertices, of N size, and a weight gradient(which can be any length) defined as: float[] weight_distribution = { 0f, 1f, 0f }; which says that the first and last vertices will have less weight and the middle vertices will have full.…
Alx
  • 651
  • 1
  • 9
  • 26
2
votes
1 answer

How to make a linear interpolation for different dates using the function "approx"?

I have a data frame with three measurements throughout the year and I would like to make an interpolation between these dates to get values every two months. I used the approx function, but I don't know how to include the values in the correct…