MATLAB: Create a filling between cftool prediction bounds

curve fittingfillingplotprediction bounds

Hey there,
Not sure if it's even possible in Matlab, but since it's possible in other programs I'll ask 🙂
I have some data that I've fitted, and I've generated the code and I'm using this code to plot it:
fitresult = fit( xData, yData, ft, opts );
xFit = logspace(4,8,1000);
yFit = fitresult(xFit);
yPredict = predint(fitresult,xFit,0.683,'functional','off');
% Plot fit with data.
hold on
h = loglog(sample69_nv20_binw,sample69_nv20_bins,'rd',sample69_nv20_binw,sample69_nv20_bins,'r.',xFit,yFit,'r',xFit,yPredict,'r--');
This works well, but I would like to make the prediction area filled in light, transparent red color instead of marking the borders, similar to what you can see in the attached picture.
Is it possible? how so?

Best Answer

So I've found the quick way to do it and I'll add it for reference, but it's simplify calling "area" with the x and y data, much easier than patch or other methods:
fitresult = fit( xData, yData, ft, opts );
xFit = logspace(4,8,1000);
yFit = fitresult(xFit);
yPredict = predint(fitresult,xFit,0.683,'functional','off');
% Plot fit with data.
hold on
h = loglog(sample69_nv20_binw,sample69_nv20_bins,'rd',sample69_nv20_binw,sample69_nv20_bins,'r.',xFit,yFit,'r');
area(xFit,yPredict,'EdgeColor','none','FaceColor',[1 0.3 0.3]);
alpha(0.1);