王佳 Posted April 18 Report Share Posted April 18 The point (1,1) corresponds to the value 1, the point (2,2) corresponds to the value 2, when I get the point (0.5,0.5) I need to output the value 0.5, similar to this interpolation😐 Quote Link to comment

codcoder Posted April 19 Report Share Posted April 19 (edited) I'm not sure I undestand the question. LabVIEW FPGA can handle math caluclation, although decimal numbers are a bit cumbersome, and the straight line formula is pretty straight forward to implement. Are you sure you need a LabVIEW FPGA for this? Do you have a very specific application? Edited April 19 by codcoder Quote Link to comment

infinitenothing Posted April 19 Report Share Posted April 19 I believe what you described is extrapolation and I think you've under defined your system (or you actually want 1d interpolation). What would points (1,2 and 2,1) correspond to? It's not totally clear how you would want to determine that 0.5,0.5 corresponds to 0.5. A naive approach would be to use the slopes of 1,1 to 1,2 and from 1,1 to 2,1. Quote Link to comment

王佳 Posted April 20 Author Report Share Posted April 20 16 hours ago, infinitenothing said: I believe what you described is extrapolation and I think you've under defined your system (or you actually want 1d interpolation). What would points (1,2 and 2,1) correspond to? It's not totally clear how you would want to determine that 0.5,0.5 corresponds to 0.5. A naive approach would be to use the slopes of 1,1 to 1,2 and from 1,1 to 2,1. I'm sorry, I probably didn't phrase it very well. As you can see in this graph, each value of X and C corresponds to a value of W, that is, a set of (X,C) determines a W. After sampling the data on this graph, the value of (X,C) that I get now may not correspond exactly to the sampled points. At this point, I need to perform a 2D interpolation to get the W value. This is my idea, not sure if I have expressed it clearly, thanks anyway! Quote Link to comment

王佳 Posted April 20 Author Report Share Posted April 20 On 4/19/2024 at 3:30 PM, codcoder said: I'm not sure I undestand the question. LabVIEW FPGA can handle math caluclation, although decimal numbers are a bit cumbersome, and the straight line formula is pretty straight forward to implement. Are you sure you need a LabVIEW FPGA for this? Do you have a very specific application? I'm sorry, I probably didn't phrase it very well. As you can see in this graph, each value of X and C corresponds to a value of W, that is, a set of (X,C) determines a W. After sampling the data on this graph, the value of (X,C) that I get now may not correspond exactly to the sampled points. At this point, I need to perform a 2D interpolation to get the W value. This is my idea, not sure if I have expressed it clearly, thanks anyway! Quote Link to comment

infinitenothing Posted April 23 Report Share Posted April 23 That part that's still confusing is that it looks like you have just one independent variable (time). If that's the case, that's just 1D interpolation. Also, your time vs x and your time vs C look like it has one slope so potentially, that's even more simple in that it's just a simple Y=m*X+b calculation. Also, it's not clear how much of this is calculable offline (no real time required). Also, your original example used extrapolation and it's not clear if that's a requirement. Quote Link to comment

王佳 Posted April 23 Author Report Share Posted April 23 8 hours ago, infinitenothing said: That part that's still confusing is that it looks like you have just one independent variable (time). If that's the case, that's just 1D interpolation. Also, your time vs x and your time vs C look like it has one slope so potentially, that's even more simple in that it's just a simple Y=m*X+b calculation. Also, it's not clear how much of this is calculable offline (no real time required). Also, your original example used extrapolation and it's not clear if that's a requirement. These graphs are just an example, and sometimes the slope may not be a constant. I would now like to tell you about my idea or need. This kind of graph above is done by planning in advance, I know the correspondence between each group (X,C) and W. I need to read the value of X and C from two encoders to find the corresponding value of W. But since it is ideal, the values of X and C are divided equally, for example, the value of X is 10 and divided into 10 parts, each with an interval of 1, but the values I read from the encoders may be 1.1 or 2.3, 3.5, etc., and the same goes for the value of C! And the values of X and C can't correspond to each other, so I can't just interpolate X or C in one dimension to get W. So I think I should find the corresponding W value by interpolating in two dimensions, but I don't know how to do it. I've only implemented one-dimensional interpolation via lookup tables so far. Anyway, thank you very much for your reply and help!🥳 Quote Link to comment

infinitenothing Posted April 23 Report Share Posted April 23 It's the same as 1D interpolation except you repeat it a few times. So, if you have data at 0,0 0,1 1,0 and at 1,1 and you wanted to get (0.7,0.3), you could start with finding the values at 0.7,0 0.7,1 and then interpolate between those two values. https://en.wikipedia.org/wiki/Bilinear_interpolation (see repeated linear interpolation) Quote Link to comment

王佳 Posted April 24 Author Report Share Posted April 24 7 hours ago, infinitenothing said: It's the same as 1D interpolation except you repeat it a few times. So, if you have data at 0,0 0,1 1,0 and at 1,1 and you wanted to get (0.7,0.3), you could start with finding the values at 0.7,0 0.7,1 and then interpolate between those two values. https://en.wikipedia.org/wiki/Bilinear_interpolation (see repeated linear interpolation) I know about bilinear interpolation. But I don't know how to do it with my lack of data points. The hollow points in the graph are known points and the solid points are the points to be interpolated, （Hollow points don't have some kind of linear relationship） I don't know how to use bilinear interpolation. I am not able to find 4 known points. Quote Link to comment

ensegre Posted April 24 Report Share Posted April 24 Frankly, It seems more that you don't know what you want, than that you don't know how to do it on a FPGA. Quote Link to comment

王佳 Posted April 25 Author Report Share Posted April 25 16 hours ago, ensegre said: Frankly, It seems more that you don't know what you want, than that you don't know how to do it on a FPGA. I think I know what I need, but I can't seem to describe it accurately. I'm sorry.😭 Quote Link to comment

infinitenothing Posted April 25 Report Share Posted April 25 Option 1: Find your 2 nearest W points (minimum Euclidian distance) Find where on the line between those two W points that's perpendicular to your unknown point Use 1D interpolation between the two W points to estimate the W point's value. Option 2: Because W1,W2, and W3 are not colinear, you can define a surface between them. The approach would be somewhat similar to the above: Find the 3 nearest points and use them to define a surface. Find the cross product of the two vectors give you a normal to the surface Find the cross product of the normal and your unknown point. That should give the point on the surface that corresponds to your unknown point. Based on what you drew (your points were nearly colinear), I expect the second method to be very sensitive to noise and thus somewhat unstable and inferior to method 1. Quote Link to comment

王佳 Posted April 26 Author Report Share Posted April 26 10 hours ago, infinitenothing said: Option 1: Find your 2 nearest W points (minimum Euclidian distance) Find where on the line between those two W points that's perpendicular to your unknown point Use 1D interpolation between the two W points to estimate the W point's value. Option 2: Because W1,W2, and W3 are not colinear, you can define a surface between them. The approach would be somewhat similar to the above: Find the 3 nearest points and use them to define a surface. Find the cross product of the two vectors give you a normal to the surface Find the cross product of the normal and your unknown point. That should give the point on the surface that corresponds to your unknown point. Based on what you drew (your points were nearly colinear), I expect the second method to be very sensitive to noise and thus somewhat unstable and inferior to method 1. Thank you for your continued help and advice. I'll think about it myself and learn to implement it on FPGA. Thanks!🙂 Quote Link to comment

## Recommended Posts

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.