I am trying to write down the general formula for a curve which must pass through / start at a given point, let's say $x_0=160,y=0$. The pass-through point is at the bottom, on $x$ axis. I need such a definition in context of curve fitting / road modeling, the road is extending upwards (away in 3D) I am trying to fit a curve to such data points, but the starting point of the curve to be user-defined. Should I use parametric curves for this? I tried this function

$$ x = 160 + a_1 + b_1 \sin (c_1 t) $$

$$ y = a_2 + b_2 \cdot e^{c_2 t} $$

With certain handpicked values I see that I can generate a curve that could be useful,

t = np.linspace(0,10,100)
polsx = [1.,1.,0.4]
x = 160 + polsx[0] + polsx[1]*np.sin(polsx[2]*t)
polsy = [1/3.,0.03,0.1]
y = polsy[0] + polsy[1]*np.exp(polsy[2]*t)


enter image description here

For data fitting purposes I would something in the form of $y = f(x)$, so I rearranged $y$ equation to get $t$,

$$ t = \frac{\log ((y-a_2) / b_2)}{c_2} $$

And I could subtitute this for $t$ and get the equation for $x$ (or I could go in other direction as well, anyway), but my question is, does this approach seems reasonable? Is there something cleaner?


I think this might help you if you want to plot a cubic equation :

$y = a(x-x_0)(x-b)(x-c)+y_0$

  • $\begingroup$ I answered before you edited, so may be, it may not help according to your new edit. $\endgroup$ – Jaideep Khare Mar 9 '17 at 15:14
  • $\begingroup$ Thanks for the answer anyway. Do you think the idea in my post makes sense? $\endgroup$ – BBDynSys Mar 9 '17 at 15:23
  • $\begingroup$ @BB_ML Frankly speaking, what you said is beyond my level.I am a high school student and I have a lot learn further. (That's the reason I joined Mathematics SE few days before) $\endgroup$ – Jaideep Khare Mar 9 '17 at 15:38

Instead of fitting $y$ against $x$, I fit $x$ against $y$. The reason is, since my pass-through point is on x-axis, if I flip the axis', I can enforce the pass-through point through the intercept. For example

$$ y = 2x^3 - 3x^2 - 3x + 2 $$

looks like

enter image description here

I can play with all coefficients as I like, but as long as I leave the intercept +2 intact, the curves will always pass through +2. When I flip the axis, I look at the whole curve from LHS, so I can model an upward moving curve of an arbitrary shape starting from 0,160.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.