I am trying to plot the mean, standard deviation and a cubic fitting on the same graph. At the moment, I use the 'errorbar' function to plot the mean and standard deviation. I use the fit function to get a cubic fitting on my data. How can I display all the information in one graph?
Here is my code
To fit the data:
f = fit(x_label',m','cubicinterp');
To plot the fitted data
figure
plot(f,x_label,m);
To plot the mean and std data
errorbar(x_label,m,exp_std,'r-');
f = fit(x_label',m','cubicinterp'); %fit the data
plot(f,'b'); %plot the fitting curve
hold on %hold the current graph
errorbar(x_label',m',exp_std','rx'); %plot the mean and standard deviation