The problem is, your data appears to be highly noisy.
You can use simple linear interpolation to interpolate the data. KSSV hs shown how to do so, using interp1. No NOT use a spline to interpolate this!!!!!! It would be highly inappropriate to try a spline, since a spline will introduce large oscillations into the curve, chasing what appears to be noise.
When highly noisy data arises, it is often the simplest models that are correct. Essentially, the signal to noise ratio is very low, so the only signal we can see above the noise may be a simple linear trend. For this, polyfit will be sufficient.
P1 = polyfit(b_reference_1,Y_1,1)
So the fitted model is just y = P1(1)*x + P1(2). You can use the model in this form, or you can use polyval to evaluate it at any point x.
By the way, if you have the curve fitting toolbox, then I would have done:
mdl1 = fit(b_reference_1,Y_1,'poly1')
Linear model Poly1:
mdl(x) = p1*x + p2
Coefficients (with 95
p1 = -0.001877 (-0.003439, -0.0003144)
p2 = 1.907 (1.525, 2.289)
And now you can use the fitted model to predict y as a function of x.
But since everybody has a copy of polyfit, I used that.
x = linspace(min(b_reference_1),max(b_reference_1),10);
plot(x,P1(1)*x + P1(2),'r-')
The alternative of linear interpolation will create this "curve", which to my eyes is hardly useful, since it appears to be chasing the noise in your data.
[b1sort,ind] = sort(b_reference_1);
y1sort = Y_1(ind);
I've overlaid it with the simple linear fit to show the difference. Now, I've worked with scientists who truly had noisy data they needed to track carefully.
The question is, if you measured the same data again for this instance, would that curve shape repeat? Or would you just see a simple trend again, but with different totally random noise on top? This is a good justification for replication, which will help you to learn if what appears to be noise in your data really is noise, or if the bumps are truly signal, and must be treated as such. Until you learn which is the case, you cannot know how to treat your data, but I would typically argue that until then, you need to use the simplest models available.