Problem with syntax of Errorbar function

1 次查看(过去 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!

回答(1 个)

Nitin Khola
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!

类别

Help CenterFile Exchange 中查找有关 Errorbars 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by