0
$\begingroup$

I have obtained some simulation result. But the number of realisations is small as each realisation is expensive.

I have the data.

for X-axis:

X={0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1};

for y axis:

Y={0.5368  0.3422  0.2814  0.2695  0.2431  0.2362  0.2338  0.2284  0.2193  0.2262  0.2208}.

I need to plot as Plot[X,Y]

One can not that the curve is not smooth. How can obtain a smooth plot from this?

So, I need Y that generates a smooth plot.

EDIT: I tried this..

 xx = {0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1};
yy = {0.5368, 0.3422, 0.2814, 0.2695, 0.2431, 0.2362, 0.2338, 0.2284, 
   0.2193, 0.2262, 0.2208};
H = Transpose@{xx, yy};
ListPlot[H, Mesh -> Full, Joined -> True, PlotRange -> All, 
 InterpolationOrder -> 2]

But id does not work properly..

$\endgroup$
  • $\begingroup$ @Kuba, just plotting a smooth curve>> $\endgroup$ – Dipankar Narayanan Feb 24 '17 at 9:43
  • $\begingroup$ @Kuba, I tried as you suggested. See my EDIT..But, I need a curve with no bending...a smooth line type of curve.. $\endgroup$ – Dipankar Narayanan Feb 24 '17 at 9:46
  • $\begingroup$ From your last comment I infer the you need to fit a curve to a model function which has the kind of smoothness that will satisfy you. You will have to come up with a model based on your knowledge of what the data represents. We can't do that for you. Look up "fit data" in the Mathematica documentation. Lot's of good info there. $\endgroup$ – m_goldberg Feb 25 '17 at 0:24
1
$\begingroup$

How about not using a polynomial fit, but an exponential one?

xx = {0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1};
yy = {0.5368, 0.3422, 0.2814, 0.2695, 0.2431, 0.2362, 0.2338, 0.2284, 
   0.2193, 0.2262, 0.2208};
data1 = {xx, yy} // Transpose
H = Transpose@{xx, yy};
p1 = ListLinePlot[H, Mesh -> Full, Joined -> False, PlotRange -> All, 
   InterpolationOrder -> 1];    
f1 = a + b*Exp[-x*c];
SolCof = FindFit[data1, f1, {a, b, c}, x];
f1 = f1 /. SolCof
p3 = Plot[{f1, 0}, {x, 0, 1}, PlotRange -> Full];
Show[p3, p1]

PS: Afaik "interpolation order" uses a polynomial interpolation, but this might not be the best solution for your dataset. I guess in general you are looking for a smooth spline interpolation that does not oscillate. Since I don't really know how to model this in Mathematica in a convenient way (we would need to state that e.g. the first and second derivative are identical at each data point and combine many polynomials). I hope this one works for you in this example. Feel free to add other terms to the function to increase accuracy, but to me it seems like a good (and simple) fit.

Smooth exponential interpolation

Best regards

$\endgroup$
0
$\begingroup$

I fail to understand, the smooth part of your question.

Anyways, you can construct an interpolating function of your data, which gives fairly smooth plot,

Y = ListInterpolation[yy, xx, InterpolationOrder -> 10];
Plot[Y[x], {x, 0, 1}, PlotRange -> All]

enter image description here

By smooth, if you mean no bumps in the curve then, it is because of your data.

But if you meant to say that you want to fit your data to a function which has not bumps then you should look at FindFit.

$\endgroup$

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