|
-
Aug 23rd, 2007, 04:01 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] Constrained Least Squares
I'm fitting data points with cubic polynomials. The standard linear least squares approach (ie. ATAc = ATy, where c are the polynomial coefficients and A is the matrix of basis functions) works just fine, but I want to guarantee that the curve go through the 1st and last points, which standard least squares doesn't do.
Anybody know how this is done from a mathematical standpoint? I can solve the problem using, for example, the solver within Excel, but I'm curious as to the math development/theory for this kind of problem. Anybody know of any reference that deals with this?
-
Aug 24th, 2007, 06:58 AM
#2
Re: Constrained Least Squares
Probably not what you're looking for, but here's a somewhat interesting and related idea.
Also, I'm not very familiar with linear algebra and the specifics of how polynomial fits are computed (Coming in 2008!). So I might say something trivial, or useless.
You could force-fit one point by translating everything over so that point is on the origin, and setting D->0 in your cubic polynomial, and then by translating everything back over.
Oooh, you could even do it again: after you've set D->0, translate everything again so the 2nd point is at the origin and restrict the constant term again to zero. Though... the constant term would then be a cubic function of A, B, and C, and setting it to zero would just add another equation to the mix equivalent to the previous one after some algebraic witchery.
Instead... you could translate the second point over to a *very* large x-value, assume the contribution from the quadratic, linear, and constant terms there are negligible, and solve for A. Of course this would only work as the translation->infinity, which probably isn't very practical.
In any case, you would have eliminated two unknowns from your cubic fit, possibly simplifying it--though linear algebra probably could do that brute force anyway (end of summer, I never really liked matricies, so I'm not gonna try to think if it could).
Perhaps the rest of the minimizing work could be done with Calculus?
The time you enjoy wasting is not wasted time.
Bertrand Russell
<- Remember to rate posts you find helpful.
-
Aug 24th, 2007, 03:10 PM
#3
Thread Starter
Fanatic Member
Re: Constrained Least Squares
Thanks. I found what I was looking for. The key is a cubic poly form that goes through two points:
y = a(x-x0)2(x-x1) + b(x-x0)(x-x1)2 + y0(x-x1)/(x0-x1) + y1(x-x0)/(x1-x0)
-
Aug 28th, 2007, 04:18 AM
#4
Re: [RESOLVED] Constrained Least Squares
Cool, looks like I was on the right track at least. I'm happy about that
The time you enjoy wasting is not wasted time.
Bertrand Russell
<- Remember to rate posts you find helpful.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|