Matching Boundary Conditions with a Polynomial (or other continuous function)

Steve D

New member
Joined
Mar 22, 2012
Messages
1
I have a polynomial that is determined using a linear least-squares fit through a bunch of data points of the form:

P1(z)= A0+A1z+A2z2+A3z3...Anzn

The polynomial does a good job representing the data within the range of the data (z1..z2), but beyond the ends of the data the P1(z) values tend to take off rapidly in the positive or negative direction.

For my application I need the data values that "straightens out" beyond the ends of the polynomial P1.

I am attempting to define a function P(z) as a "piece wise" spline where:

P(z) = P0 when z0 <= z <= z1
P(z) = P1 when z1 <= z <= z2
P(z) = P2 when z2 <= z <= z3

Where P(z) and all of it's derivatives must be continuous over the range z0..z3.

My difficulty is in finding P0 such that:

P0(n)(z1) = P1(n)(z1) for all n, where P0(n) is the nth derivative of P0

and

P0(n)(z0) = 0 for all n > 1

A parallel in the real-world is to be traveling on a straight path, go through some curves that are represented by a polynomial, then end on a straight path.

I tried using:

P0(z) = A0+A1z+((z - z1)/(z2-z1))(A2z2+A3z3...Anzn)

Which meets the conditions for value, unfortunately the P0'(z1) does not equal P1'(z1) etc (derivatives don't match). I also tried creating a polynomial by assuming I want the n'th derivative of P0 to be of the form B0 + B1z, solving for B0 and B1 using the value for P1 at z1, then integrating to arrive at additional polynomial coefficients, but that didn't work either.

FYI: I haven't been a student since 84' and my calculus and differential equations are a bit rusty.

It seems like this might be a common problem, but I don't know what to call it for an internet search.

Can anyone point me in the right direction?
 
I have a similar problem but in the Laplace domain. I use pole/zeros in the form H(s):

H(s) = Z(s) / P(s) where Z(s) = a produce of (s - si) and P(s) = a produce of (s - sj). The 'j' references 1 to the nth 'pole'. Same idea for 'i' but these are zeros. If you have 'n' data points, you may need 'n' poles. This will work, but there is another way that may do the job and has no problems on its ends, straight and flat.

A Lorentz function = 1 / ( 1 + x2) which looks like a perfect mountain. It looks similar to a Gaussian curve if that helps. Create a series of these and it may do the job. There is a Windows app called CurvFit that does just this. Its freeware, so nothing to loose. I'm the author. It was written to demonstrate how a Calculus-level computer language, FortranCalculus, can easily solve such curve fitting problems.
 
Top