Plotting Error bars using minimum and maximum values in Matlab
显示 更早的评论
Hi,
I'm trying to plot an x by y graph. There are several y values for each x value so I want to plot the average of these with error bars. I want each error bar to have the largest value as the upper limit and the smallest value as the lower limit for every point plotted. How do I do this? (I just can't seem to get my head round the help already available on 'errorbar' in matlab)
Thank you in advance.
采纳的回答
更多回答(1 个)
Evangelia Antonopoulou
2022-6-23
Hi! If I understood the question correctly, you want an error bar with top to be the maximum value of y and bottom to be the minimum value of y. Neither of the above aswers give you that. The 2nd answer will give you an error bar for the top the size of the maximum value, so the top value will be mean+max and not max.
I did the following:
mny=nanmean(y);
ypos=max(y)-mny;
yneg=mny-min(y);
errorbar(mouse,mny,yneg,ypos)
Here, the size of the error bar for the top value (similarly for the bottom) is max(y)-mny which will result to a top value of the error bar to be the actual max.
Hope my answer is clear :)
类别
在 帮助中心 和 File Exchange 中查找有关 Errorbars 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!