Curve Fitting Problem
Ben Abbott
bpabbott at mac.com
Thu Jun 26 20:14:12 CDT 2008
On Jun 26, 2008, at 6:57 PM, A. Kalten wrote:
> Hello,
>
> I need some advice on solving a curve fitting problem.
>
> Ordinarily, a curve fitting algorithm, such as polyfit
> or wpolyfit in octave, will determine the coefficients of a
> polynomial that best fits the empirical data. If the model
> is a second degree polynomial, a x^2 + b x + c, the algorithm
> will return the best coefficients a, b, and c.
>
> The trouble I am having is that I need to fit a second
> degree polynomial where some of the coefficients are
> either already known or include another known parameter
> as a factor. For example, I need to find the best value
> for k in this equation:
>
> k^2/4 x + k p x + p^2
>
> where p is a known quantity.
>
> Although there are three coefficients, there is really
> only one unknown parameter, that is k. Using polyfit from octave
> will return a, b, and c where a = k^2/4, b = k p, and c = p^2.
>
> Solving the two equations for k gives values that
> are significantly different (they differ in the second
> decimal place).
>
> Is there an algorithm available that allows some of the
> parameters of the model to be predetermined or to include
> some predetermined factor?
>
> I suspect that the only solution would be to write a
> custom least squares program.
>
> AK
I assume you intended your example to be: k^2/4 * x^2 + k * p * x +
p^2 ?
On first inspection, it appears your example has non-linear constraints.
Is this example the specific problem you'd like to solve, or are you
looking for something a general solution?
Ben
More information about the Help-octave
mailing list