in reply to Re: operate on an array created in a subroutine
in thread operate on an array created in a while loop

I must have posted the update while you were replying. In my OP I put a link to the output. The output curve is right, there's nothing like you're suggesting. I only need to the shape of the curve to be approximate (since I have no idea what it really should look like), and although the X-value at Y-max isn't exact in my output, it's close enough for what I need, but its height has to be exact.

  • Comment on Re^2: operate on an array created in a subroutine

Replies are listed 'Best First'.
Re^3: operate on an array created in a subroutine
by SuicideJunkie (Vicar) on Oct 16, 2013 at 14:03 UTC

    The Excel curve is based on three control points, the Math::Interpolate one is based on five controls.

    I presume that means the excel plot is using a quadratic interpolation (3 pts).

    If that's true, then you need to set M:I to use a quadratic interpolation as well if you want the results to match closely. Even then, using a different set of data (5 pts instead of 3) will ensure that your interpolation is slightly different.

    If you want it to be exact, you need to use the exact same input.

      Based on what I've read (and this isn't official from Microsoft) Excel uses Bezier interpolation to create smooth curves from three or more points. I played around with polynomials and it never looked right. Increasing the number of controls points generated larger polynomial equations and the curves didn't look like what I want. That's how I learned about Beziers and subsequently splines. I tried both of those modules, and now the Interpolate one. Here is an example of Spline vs. Interpolate. Also in this graph is the Interpolate with three control points. As you can see the three points makes just a parabola (p<0). https://www.dropbox.com/s/9cnl1jp9zzzhh19/Interpolate_example1.1.pdf

      So far only Math::Interpolate has given me a shape that is close enough to what I need with 5 points (three real points and two that are guesses). The problem is the height of each point. That has to be right. Hence the need to scale.

      Does this website ever post replies? I've replied to this a long time ago and it still isn't showing up.