Help with MATLAB Graphing Error Bars for 1D Arrays

  • Context: MATLAB 
  • Thread starter Thread starter smileandbehappy
  • Start date Start date
  • Tags Tags
    Graphing Matlab
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 3K views
smileandbehappy
Messages
66
Reaction score
0
Im trying to plot a graph with eror bars for two 1d arrays. But for some reason MATLAB won't let me do it. Can you please help me as quickly as possible as I am currectly sitting in a computer lab and am very tired.

My code is:

W = 10:10:60;
V1 = [0.103,0.223,0.351,0.436,0.555,0.664];
e = (+-0.05);
errorbar(W,V1,e)

thanks
 
Physics news on Phys.org
your problem is with variable 'e', it must be a vector of same length as W and V1. It is okay to specify constants in a vector, but +- is not a valid prefix. Leaving off the +-, the plot will give a symmetric error-bar 2e long.