Problem with syntax of Errorbar function
2 ビュー (過去 30 日間)
古いコメントを表示
I have 3 vectors:
time = 1x2035
y=nanmean(matrix), 1x2035,
e=std((Matrix),'omitnan'), 1x2035
I want to plot y by time, and have error bars for each value of y at each time interval. Additionally, I would like to create the same plot, but not include the error bars(so just dots where the error bars would end).
How would I go about this? Thanks in advance!
0 件のコメント
回答 (1 件)
Nitin Khola
2015 年 11 月 4 日
My understanding is that in one of the plots you wish to have errorbars and in the other, you want to have some markers at the end points of an errorbar. You can use the "errorbar" function for the former and for the latter, you can create two additional vectors, "y+sigma" and "y-sigma", and plot them simultaneously. To ensure that just the markers show up, set the 'LineStyle' property to 'none'. You can experiment with marker styles. For the example code below, I am using the asterisk symbol as marker.
x = 0:pi/10:pi;
y = sin(x);
e = std(y)*ones(size(x));
figure
% errorbar(x,y,e)
plot(x,y)
y2 = y+e;
y3 = y-e;
hold on
plot(x,y2,'*','LineStyle','none')
plot(x,y3,'*','LineStyle','none')
I hope it helps!
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Errorbars についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!