shaded confidence interval plotting with shade area (patch)
Show older comments
Hello,
I'm trying to plot the shadow area between the confidence interval with the line in the middle. I've tried a few approaches, but each time I'm getting the same results (plot image). I've attached a data and code below. Please help, I don't know why I have this problem. I've read similar tags, and tried to adhere to the solutions, but it seems that doesn't work for my case.
% Using Matlab - calculations of confidence interval
pd = fitdist(X,'Normal')
ci = paramci(pd)
a4=ci(1,1)/pd.mu;
b4=ci(2,1)/pd.mu;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x=X.*a4;
y=X.*b4;
Ymax=y;
Ymin=x;
figure
plot(time,Ymax)
hold on
plot(time,Ymin)
line([time(end) time(end)],[Ymin(end),Ymax(end)])
line([time(2) time(2)],[Ymin(1),Ymax(1)])
patch([time fliplr(time)], [Ymax fliplr(Ymin)], 'g')
Accepted Answer
More Answers (0)
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!