I'm trying to fit a curve to my data (shown below), but I'm not sure of the best way to do it. I tried an exponential function following this tutorial, but it didn't fit the data at all (just a vertical line), and now a square root function ( y~x+sqrt(x) ), which seems to fit the data well but curves upwards near the y axis, which is unrealistic. It is an understatement to say mathematics is not a strong point for me, and I'm struggling to find the right option. How can I make a line that only curves upwards, but does so gradually?

plot with upward curve

  • $\begingroup$ This looks very exponential. I wonder if you made a mistake in your code/fit process. $\endgroup$
    – kleinerde
    Apr 2, 2022 at 12:17
  • $\begingroup$ Please, joint to your question the numerical data (instead of graphical). One cannot reproduce what you did without data. $\endgroup$
    – JJacquelin
    Apr 13, 2022 at 8:55

1 Answer 1


Have you already tried y = a + bx + cx^2? You will need to use regression software to find the values of a, b, and c (which your software will probably call betas 0, 1, and 2)

  • $\begingroup$ Thanks, that's done it. I had used a squared term before and the curve went the other direction (correctly) - I had thought that to get the opposite direction I needed to use the opposite function... Now I realise it's just to do with the positive/negative coefficients facepalm $\endgroup$
    – Picapica
    Apr 2, 2022 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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