3
$\begingroup$

I am looking for the way to "quite easily" express particular curves using functional equations.

s-curves

What's important (supposing the chart's size is 1x1 - actually it doesn't matter in the final result):

  • obviously the shape - as shown in the picture;
  • there should be exactly three solutions to f(x) = x:
    x=0, x close to or equal 0.5 and x=1;
  • (0.5,0.5) should be the point of intersection with y = x;
  • it would be really nice, if both of the arcs are scalable - as shown in the left example (the lower arc is more significant than the upper one).

I've done some research, but nothing seemed to match my needs; I tried trigonometric and sigmoid functions too, they turned out to be quite close to what I want. I'd be grateful for any hints or even solutions.

P.S. The question was originally asked at stackoverflow and I was suggested to look for help here. Some answers involved splines, cumulative distribution functions or the logistic equation. Is that the way to go?

  • 0
    Thanks again for that suggestion. However, will it overcome the "going out of range" and "not soft behavior" problems, which are being considered in Rahul's answer below?2012-07-15

2 Answers 2

3

For what it's worth, the interpolating polynomial through the points $(0,0), \big(\!\frac14,a\big)$, $\big(\!\frac12,\frac12\!\big)$, $\big(\!\frac34,b\big)$, and $(1,1)$ is $p(x) = \left(-7+16 a+\frac{16 b}{3}\right) x+\left(\frac{136}{3}-\frac{208 a}{3}-\frac{112 b}{3}\right) x^2+\left(-80+96 a+\frac{224 b}{3}\right) x^3+\left(\frac{128}{3}-\frac{128 a}{3}-\frac{128 b}{3}\right) x^4.$ However, it overshoots the range $[0,1]$ on similar input to the first image. Below I picked $a = \frac18$ and $b = \frac{13}{16}$.

enter image description here

  • 0
    And thanks for the Hermite suggestions.2012-07-15
1

Have you tried polynomial interpolation? It seems that for 'well-behaved' graphs like the ones you are looking for (curves for image processing?), it could work just fine.

At the bottom of this page you can find an applet demonstrating it. There is a potential problem with the interpolated degree 4 curve possibly becoming negative though. I'll let you know once I have worked out a better way to do this.

EDIT: The problem associated with those unwanted 'spikes' or oscillations is called Runge's phenomenon . I would guess that image manipulation programs like Photoshop actually use Spline interpolation to find the curves.

  • 0
    Just edited my answer with some extra info and another possible method. Hope this helps!2012-07-15