Problem with syntax of Errorbar function
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Nitin Khola
il 4 Nov 2015
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 Commenti
Vedere anche
Categorie
Scopri di più su Errorbars in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!