How can I plot 2 graphs with errorbar each one?

Dear community
I'm plotting 2 graphs and I want to put errorbar in each plot.
How can I do that?
Thanks!

 Respuesta aceptada

dpb
dpb el 13 de Jun. de 2019

2 votos

Use errorbar and hold on or as per the documentation, if y is a matrix errorbar plots a separate line for each column.

4 comentarios

i'm using this script
hold on
err_C = [(Voc_desv_C)];
x = linspace(0, 50, numel(Voc_C));
errorbar(x,Voc_C,err_C)
err_D = [(Voc_desv_D)];
x = linspace(0, 50, numel(Voc_C));
errorbar(x,Voc_D,err_D)
y1 = Voc_C;
y2 = Voc_D;
plot(x,y1,x,y2)
xticks(1:50);
title('Voc Plot')
xlabel('Tiempo (Días)')
ylabel('Voc (V)')
legend('Voc Clean','Voc Dirty');
And appers a third color (purple) and (I think) asume the legend to errorbar of each one (not to y1 and y2)
Jonathan Bijman
Jonathan Bijman el 13 de Jun. de 2019
Please light me with your wisdom @Walter Roberson =(
dpb
dpb el 13 de Jun. de 2019
Editada: dpb el 13 de Jun. de 2019
Why are you using plot to draw the same data as are drawn with errorbar?
x = linspace(0, 50, numel(Voc_C)); % x points vector (row)
X = [x;x].'; % 2-column X to plot against
Y = [Voc_C(:) Voc_D(:)]; % 2-column Y to plot
err=[Voc_desv_C(:) Voc_desv_D(:)]; % 2-column error to plot
errorbar(X,Y,err)
title('Voc Plot')
xlabel('Tiempo (Días)')
ylabel('Voc (V)')
legend('Voc Clean','Voc Dirty');
Jonathan Bijman
Jonathan Bijman el 13 de Jun. de 2019
Thank U so much! it works =)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Etiquetas

Preguntada:

el 13 de Jun. de 2019

Comentada:

el 13 de Jun. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by