Having problems when plotting errorbars

3 views (last 30 days)
Guillermo Lopez
Guillermo Lopez on 6 Jun 2012
Hi everyone. I have some problems when plotting errorbars on my graph. I have a figure which I have plotted using subplot:
subplot (5,3,[10,13]); %here goes the axis with the real parts
hold on
plot(theory_data(1:100,1),theory_data(1:100,2));
plot(real_data(1:9,2),real_data(1:9,1),'o');
title('Theory vs calculated nflake_re');
xlabel('wavelength(nm)');
ylabel('real part refractive index');
I define error as error_calculation=0.3 (a random value of my error). To put my errorbar therefore I write as stated in matlab help (errorbar(X,Y,E)) under the ylabel line of code:
errorbar (real_data(1:9,2),real_data(1:9,1),error_calculation);
This way when I run the code, I only get a line on the left of my graph (on top of the actual y axis) but not on the actual data points (where i want the error bars). So my question is; why is this happening? Am I doing something wrong? My data points are taken from a table with a column for the x values (real_data (1:9,2) and a column for the y values (1:9,1).
Thanks in advance

Answers (0)

Community Treasure Hunt

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

Start Hunting!