0

I would like to find a better way of fitting my data. Right now, that it the best I can do, see Figure.

enter image description here

It's done using Gnuplot and smooth when plotting. However, as you might see in the Figure, 'csplines' seems to be the most acuarate technique, but it is not enough. It is fine in the first half of the graph, but not good at all in the second half. The real data, just 4 points in 'x=[1,2,4,8]', is marked in 'Line 1'. Is there a better way of doing it using Gnuplot?

What about Matlab (or even other tools)? How can I easily create a smooth curve connecting a few points?

Manolete
  • 3,431
  • 7
  • 54
  • 92
  • What output do you expect? You can only fit data, if you have an underlying model. What you do is called interpolation. – David Zwicker Feb 07 '13 at 10:43
  • @DavidZwicker I expect something similar to 'csplines' but perhaps a bit smoother.If you realize, the pink curve between x=[4-8] it goes down and then up again, it should not do that. From x=4 to x=8 should be a smooth connection. Is that possible at all? – Manolete Feb 07 '13 at 10:56
  • 1
    The connection is smooth. You probably want it to be monotonic. Why do you want to draw the line in the first place? You only have four data points and the only honest method of interpolation is probably a linear one, if you want to guide the eye of the reader. Alternatively, you may have a proper model, which you can fit to the data, i.e. some exponential decay or something similar. It then depends where your data came from. – David Zwicker Feb 07 '13 at 10:59
  • Similar question asked 2 days ago for matplotlib: http://stackoverflow.com/questions/14705062/plotting-a-smooth-curve-in-matplotlib-graphs – pelson Feb 07 '13 at 11:56
  • If you want to fit, fit it with an inverse function as it is monotonic. Or plot f(1/x). – hyamanieu Feb 07 '13 at 13:39

1 Answers1

1

Why not have a look at the scipy interpolation documentation:

http://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html

There are plenty of schemes there which will help you plot your smoothed data using matplotib.

HTH

pelson
  • 21,252
  • 4
  • 92
  • 99