3
$\begingroup$

I have a collection of measurement deltas $m_1...m_n$ where each measurement consists of two points $(x_{n1},y_{n1})$ and $(x_{n2},y_{n2})$ the $x_{n1}$ and $x_{n2}$ represent where the measurement was taken, and in the case of my problem it's a distance that is known, and those values are measured at the same time, so I know the $\Delta y$ for the measurement, but between any two measurements $m_n$ and $m_{n+1}$ the measurement equipment is moving, so there is some $y$ offset between the measurements that is unknown which I will call $d_n$. so for a given measurement $m_n$ : $y_{n1} = d_n$ and $y_{n2} = \Delta y_n + d_n$ I am trying to find a best fit solution for all of the $d_1...d_n$, where I'm defaulting $d_1 = 0$, but every value offset after that $d_2...d_n$ will be calculated based on the surrounding measurements. The end goal is that all the points $(x_{n1},y_{n1}),(x_{n2},y_{n2})$ fall as close as possible to the original unknown function that was being measured. Each measurement $m_n$ overlaps with it's neighboring measurements, and may even overlap with the two previous and the two next such that $x_{(n-1)2} > x_{n1}$ and $x_{(n-1)2} < x_{n2}$ and $x_{(n+1)1} < x_{n2}$ and $x_{(n+1)1} > x_{n1}$. The distance between the points in a measurement $x_{n1}$ and $x_{n2}$ are approximately the same distance every time, but given how they are taken, it can vary slightly from one measurement to the next.

Below is a picture showing what is being measured. Let's say that the black line is the true shape of what is being measured, and the red lines are the measurements. The lines here are shown on top of the true shape of the line, but when the measurement is taken all we know is where it begins and ends (the $x$ values) and the $\Delta y$. What I am trying to do is take a lot of these red measurements where I know the $\Delta y$ between the $x$ values and reconstruct the original black line as best as possible.

enter image description here

These line segments overlap with each other, and I'm trying to shift the line segments up and down to find a sort of best fit for those line segments to reconstruct the original curve.

The problem I'm running into is that I can take one line segment and interpolate where $x_1$,$y_1$ of the next line should most likely fall, but every time I move a line segment up or down it affects the best fit of the lines adjacent to it, so I can't think of a way to calculate a best fit of all the line segments simultaneously because each line segment affects the positioning of the line segments ahead and behind it.

My first attempt at solving this problem was to loop through all the measurements $m_1...m_n$ and in my first forward pass I would interpolate the position of the next measurement offset $d_{n+1}$ using the measurement $m_n$ (as a side note, the starting position of $y$ doesn't really matter, so the first delta $d_1$ I'm assuming that the $y$ position starts at 0), and then I did a backward pass where I started at the end and I used the next measurement $m_{n+1}$ to interpolate the $d_n$ of the previous measurement $m_n$, and then I did a final smoothing pass where I would look at 3 measurements at a time ($m_{n-1},m_n,m_{n+1}$) and for the middle measurement $m_n$ I would look at what the offset $d_n$ should be if interpolated based on $m_{n+1}$, and what the offset $d_n$ should be if interpolated based on $m_{n-1}$ and I averaged the two and applied that offset $d_n$ to the middle measurement $m_n$ and then moved ahead with another three measurements where $m_n$ is now $m_{n-1}$

The results from this seem reasonable, but I know it's not the mathematically best fit and it's really just a good enough approximation, but I'm concerned that finding the absolute best fit would computationally take too long and get exponentially longer with the more measurements that are added.

Is doing a forward pass where the past measurements predict the future measurements and then a backward pass where the future measurements predict the past measurements and then trying to average between the two in a final pass about as good as I can get, or is there a better way to find the best fit of these measurements?

$\endgroup$
5
  • 2
    $\begingroup$ Your description is confusing. You use words that could be given many possible meanings, but do not explain what you mean by it, and just expect we will know. "Measurement deltas" (deltas between what?); "relative" (relative to what?); "not aligned end-to-end" (what isn't aligned? what "ends"?). Try to read your post from the point of view of someone who doesn't know anything about your problem already. And who hasn't taken exactly the same math classes as you and thus may not have learned the exact same jargon. $\endgroup$ Nov 2, 2023 at 17:19
  • 1
    $\begingroup$ You haven't described it abstractly, you have described poorly. It doesn't matter where the problem comes from or why you are asking it. If you do not describe it clearly, we cannot figure out what you are asking, and thus we cannot provide an answer. $\endgroup$ Nov 2, 2023 at 19:47
  • $\begingroup$ You have a sequence of triples $(a_i, b_i, c_i)$ for $i=1,\dots,n$ and you know that some unknown function $f$ satisfies $f(a_i) - f(b_i) = c_i$. You want to find the best estimate you can for $f$ (up to adding a constant). Is that accurate? And are there any further restrictions on the triples - for example, in the drawing it looks like the distance $a_i - b_i$ is fixed? $\endgroup$ Nov 3, 2023 at 6:46
  • $\begingroup$ @MishaLavrov I think what you are describing is close to what I was describing. I updated my question and hopefully it makes more sense. $a_i - b_i$ is not fixed, but it's approximately the same every time. Also $a_{i+1} - a_i$ is approximately the same every time, but again it's not exact and can vary. $\endgroup$
    – TJR
    Nov 3, 2023 at 15:51
  • $\begingroup$ @TJR. Instead of raising the problem on a theoretical manner (with words which might confuse) better edit in your question a numerical example (what is measured on the form of data). May be this will make the problem more concret so that someone might answer. $\endgroup$
    – JJacquelin
    Nov 22, 2023 at 15:32

0

You must log in to answer this question.

Browse other questions tagged .