MATLAB Help with MATLAB Graphing Error Bars for 1D Arrays

  • Thread starter Thread starter smileandbehappy
  • Start date Start date
  • Tags Tags
    Graphing Matlab
AI Thread Summary
The discussion revolves around an issue with plotting a graph with error bars in MATLAB using two 1D arrays. The user is attempting to create the plot but encounters a problem due to the definition of the error variable 'e'. It is clarified that 'e' must be a vector with the same length as the arrays W and V1. The suggestion is to define 'e' as a vector of the same size, and the notation "+-" is not valid in this context. Instead, specifying a constant value for the error will result in symmetric error bars.
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.
 

Similar threads

Replies
4
Views
4K
Replies
1
Views
4K
Replies
3
Views
2K
Replies
4
Views
2K
Replies
1
Views
5K
Back
Top