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
0
votes
0 answers

Imaging lat, lon, alt data after (lat,lon) -> (x,y) -> (lat,lon) conversion

I have (lonvec, latvec, altvec) data, extracted from an dataset based on an equirectangular projection. I am converting the coordinates to (xvec, yvec, altvec). I'm using this data for an interpolation using: X = np.linspace(xvec.min(),…
AaronJPung
  • 1,105
  • 1
  • 19
  • 35
0
votes
1 answer

Null pointer exception returned when accessing index in 2D Array

I'm currently working on a game in Processing where there are 3 equally spaced platforms on the left and right sides of the screen and 2 platforms on the bottom of the screen. The player in the game is a ball which spawns on one of the platforms.…
0
votes
0 answers

Polynomial interpolation of a function in Octave

I need to interpolate a function using polynomial interpolation, but I'm not sure how to code the part to get the polynomial and its coefficients: My function: fx = @(x) sin(3 .*x) ./ (0.4 .+ (x .-2) .^2); My 9 sample values: xs = 0:0.5:4; ys =…
TheMortiestMorty
  • 421
  • 2
  • 4
  • 12
0
votes
0 answers

Matlab interpolation of a 2D ARRAY

This must be an easy question. I have a matrix (2D Array) of 293 rows and 200 columns (293 x 200), and I want to interpolate them to get a 2D Array of 241 rows and 145 columns (241 x 145), what is the easiest way to do it in Matlab ? I can use…
lefou
  • 13
  • 4
0
votes
2 answers

How to wrap last/first element making building interpolation?

I've this code that iterate some samples and build a simple linear interpolation between the points: foreach sample: base = floor(index_pointer) frac = index_pointer - base out = in[base] * (1 - frac) + in[base + 1] * frac index_pointer…
markzzz
  • 47,390
  • 120
  • 299
  • 507
0
votes
1 answer

Conditionally insert rows into pandas DataFrame

Here is the problem I pull a csv into a pandas data frame that looks like so: Identity Date value1 value2 Random Apple 1/1/2005 10 10 Orange Apple 12/1/2005 1 1 Orange I need to then call…
Tyler Cowan
  • 820
  • 4
  • 13
  • 35
0
votes
1 answer

find where the maximum deviation of an interpolated function occurs?

I need to compare the maximum deviation of the interpolated function to the true value of the functionf(x)=exp(x). I don't know how to find the x-value where this occurs as i used x=np.linspace() to plot the interpolation and the true function. My…
0
votes
1 answer

How does glsl's texture2d command work with GL_LINEAR textures

I am not sure how exactly the texture2D command works in GLSL with linear filtering. How does it choose and linearly interpolate between pixels. Imagine I had a texture with 4 grayscale pixels of value {0, 1, 2, 3}. And I wanted OpenGL to draw it…
user3758015
  • 119
  • 1
  • 9
0
votes
1 answer

C++ Getting 1.#INF

i'm trying to calculate the FPS of my game, but the value is not stable, so i wanted to implement linear interpolation to make the displayed text smooth.. The problem is that i'm getting 1.#INF values, I tried googling but couldn't really find an…
0
votes
1 answer

piecewise linear interpolation in R

I understand you can use approx function to linearly interpolate. However, I could not find anywhere how to piecewise linearly interpolate the pair of points. For instance, assume x<-c(1,4,3,2) y<-c(4,3,2,1) Can anybody give me an answer? Thanks a…
BJKIM
  • 11
  • 1
0
votes
0 answers

Repeat a color scale along a surface with interpolation

I am trying to shade a surface with a sequence of colors to achieve certain visual effects. One effect is a gradient from one color to another. Assume I have a lookup texture with a black and a white texel. I apply the colors to the whole surface by…
J-S
  • 425
  • 3
  • 17
0
votes
1 answer

why Bilinear interpoation generates exact original image on expanding and shrinking by same factor

So I have implemented the bi-linear interpolation as in wiki,and other sources where they use the fraction of distance from the neighboring pixels to compute their contributions. My two issues are: my results don't tally with the matlab…
0
votes
1 answer

Interpolation and replace zeroes

I have 3 x n (n is random number) matrix in MATLAB. Example for n=13: M = [40, 0, 0, 0, 41, 0, 0, 0, 0, 0, 41.6, 0, 20; 20, 0, 0, 0, 23, 0, 0, 0, 0, 0, 23, 0, 189; 102, 0, 0, 0, 192, 0, 0, 0, 0, 0, 96, 0, 21]; The number of zeroes between…
dejh
  • 1
  • 2
0
votes
1 answer

Simple resetting timer method to help lerp between a materials alpha values 1 - 0

I am working on a 'Shield' script (sci-fi, not RPG, imagine a spaceship) that only becomes active once a collision has happened. I'm trying to achieve this by having the alpha value of the material be set to 0f - then once 'hit' going straight up to…
JonHerbert
  • 647
  • 1
  • 8
  • 23
0
votes
2 answers

implementation of interp1 function of MATLAB in J2ME

i am looking to implement the interp1, 1-D data interpolation (table lookup), function available in MATLAB in J2ME or JAVA. here is the link http://www.mathworks.com/access/helpdesk/help/techdoc/ref/interp1.html Is there any library available in…
Jeeka
  • 861
  • 2
  • 11
  • 21