문제

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top