How to fit curve using derivatives as a constraint

조회 수: 3 (최근 30일)
Suzie Oman
Suzie Oman 2017년 7월 8일
댓글: Suzie Oman 2017년 7월 10일
Hi there -
I'm working on fitting points to a surface to find the next point on the surface but need the derivatives to match up. How can I do this?
This would be in 3D and I am currently using the fit function.
Thanks!
  댓글 수: 6
Walter Roberson
Walter Roberson 2017년 7월 10일
You cannot do meaningful fitting without a model to fit against.
Suppose you have a finite number of points, each expressed to a finite number of decimal points. Express each as a rational number. Then you can always find greatest common divisor, and that divisor will divide all the distances. Now you can construct a sine function whose half wavelength is that distance and with zero phase at the smallest of the values. Because the distances are all multiples, it follows that the sine will be zero at all of the other points. Therefore if you hypothetically had a unique function f(x,y) that fit the surface exactly, adding this sine wave would also fit the surface exactly, violating the hypothesis that the function was unique. The same happens if you multiply the sine function by any arbitrary non-zero amplitude; therefore there are an infinity of such functions.
Okay, but what about the constraint added by matching the derivative? Well, take the harmonic of that sine, three times the frequency, and add it in with -1/3 of the amplitude given to the sine. The derivative of the sine is cosine so if the sine, derivative of -1/3*sin(3*x) is -cos(3*x) so cos(x)-cos(3*x) . And at every point where sin(x) is 0, that will be 0 because the two terms are the same sign and so cancel each other out. Therefore if you hypothetically had a unique function f(x) that fit the curve exactly, then adding A*sin(f*x) - A/3*sin(3*f*x) would have no effect on the function or the derivative at those given points, and therefore there are an infinite number of functions f(x) that fit, not a single function.
As we have now established that if there is one function that fits all of the points and their derivatives exactly, there must be an infinite number, then we have no way of choosing which of the infinite number of functions is the "right" one.
It is therefore meaningless to fit a finite set of discrete finitely-denoted points and derivatives-at-points unless you already have a model to fit against.
The problem in one sense gets even more difficult if the finite set of points are not considered to be exact but are instead considered to be rounded or to have noise (even if only floating point round-off at each step of the computation): if you had f(x,y) that fit each point as given, then obviously f(x,y)+delta fits to within precision bounds for sufficiently small delta, and f(x+delta_x, y+delta_y) must give a result within precision bounds for sufficiently small delta_x and delta_y . This gives us "more" functions that fit. However, we already had an uncountable infinity of functions that fit, so adding another uncountable infinity does not give a larger infinity.
In summary: never try to do fitting without a model or set of models to fit against.
Suzie Oman
Suzie Oman 2017년 7월 10일
Perhaps I am doing a bad job explaining.
The problem isn't the equation but how to interpolate the next point, creating a smooth surface without any derivative changes and having continuity in 3D. Right now, I am capable of doing the continuity in 2D - either x-z, or y-z but not x-y-z.
Does that make any more sense?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Smoothing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by