How to find a curve from points?
Mar 10, 2011 at 11:49pm
How to find a curve from points?
I’ve been struggling with this for some days now.
I have a float going from 0. to 1. and I want to scale it to numbers from 40 to 20000, not linear …
It should have the same curve as the Hz-fader in Lexicon’s PCM plug-ins, but I can’t figure out the equation.
I have extracted some points from the curve:
(I can get the first number (x) into Max, the other number (y) I have to read off the screen, the vst~ doesn’t output Hz value, just fader value 0. to 1.)
I could keep on extracting points, but then, how do I find the right equation for the curve?
And even better, is there another way?
Sincerely – Jonas Barsten Johnsen
Mar 11, 2011 at 1:24am
to me your curve doesn’t seem to be curve. It seems to follow be this (linear) equation:
y(x) = x * 1800 +40;
y(0.0055555) = 0.0055555 * 1800 + 40 = 50 (with some differences because of the rounding)
Mar 11, 2011 at 12:37pm
Thanks for your answer Jan.
I should have presented a more representative selection of points:
As you can see now, it’s not linear, but thanks a lot for your suggestion!
Now, as I have these points, are there any way of interpolating between them, send them to a table and use that as a scale?
Keep up the good work!
Mar 11, 2011 at 6:12pm
Couple of options.
The mathematical way is to use the method of least squares to get a best fit for a polynomial of whatever order you want (quadratic, cubic, quartic, etc.). Doing that by hand is hard, but Mathematica or other math-oriented software would have a function for that. Somewhere.
Perhaps a more manageable way would be to build a 101-point table (with the indices 0, 1, 2, etc. representing the x values 0.00, 0.01, 0.02, etc.). Store appropriate values in the table, then hook up something like [float]->[* 100]->table.
Finally, even with the extra numbers it looks more like what you’ve got is not really a smooth polynomial but several line segments. For instance, in the range [0.9 .. 1.0] the relation appears to be f(x) = 11000 + 90000*(x-0.9). (Caveat: this is quick eye-balling, my arithmetic might be off somewhere. The principle still holds.) If this is the case, you can use a chain of [split] objects to separate out the x ranges and feed each one into an appropriate [expr].
Mar 11, 2011 at 7:00pm
It’s a small tool that gains the credit for this result:
You can find it here, but unfortunately everything is in German. (http://www.mathe-online.at/nml/materialien/innsbruck/regression/)
Here is the equation with a reasonable prognosis that still has a reasonable length:
x1 are the values on the left of your table.
x2 = -34.3261 + 14273.3843(x1^2)-24946.0709(x1^4)+30918.0835(x1^6)
the graphic show your values from the table in relation with the result of the equation above.
But looking at this diagram indeed it seems that the relation between the values are related in different line-segments.
Mar 11, 2011 at 7:44pm
Jan, that’s awesome!
And Peter, thanks for your contribution :)
I figured I have already used so much time on this, I just started to register many points, for making an [itable].
I have registered the following points, I couldn’t figure out how to use that German program, could you put there values into it and see if you get an equation?
#, Hz (0-1000);
1, 40 0;
Sincerely – Jonas
Mar 11, 2011 at 9:39pm
I put these values in MSexcel and it is definitely 4 separate linear segments– best to use a lookup table,
and this one
You must be logged in to reply to this topic.