Quantcast
Channel: Math.NET Numerics - Math.NET
Viewing all articles
Browse latest Browse all 224

Fitting a broken line

$
0
0

@Benjamin_Sachtleben wrote:

Hallo,

i try to fit a curve based on 3 lines connected at their ends (broken line with 2 inner knots).
The first and the last point is fix, the position of the two inner knots should be optimized.

I have a c# function (method) describing my target function with 4 parameters to optimize bx,by,cx,cy.
Is it possible to use math.net fit to find the best values for the 4 parameters?

public double FunctionBrokenLine2Knots(double x, double ax, double ay, double bx, double by, double cx, double cy, double dx, double dy)
        {
            double result;
            double[] points = new double[4] {ax,bx,cx,dx };
            double[] values = new double[4] {ay,by,cy,dy };
            
            var r2 = MathNet.Numerics.Interpolate.Linear(points, values);
            result = r2.Interpolate(x);
            return result;
        }

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 224

Trending Articles