www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/ControlErrorBarsLengthsInAllDirectionsExample.m

    %% Control Error Bars Lengths in All Directions
% Display both vertical and horizontal error bars at
% each data point. Control the lower and upper lengths of the vertical
% error bars using the |yneg| and |ypos| input argument options,
% respectively. Control the left and right lengths of the horizontal error
% bars using the |xneg| and |xpos| input argument options, respectively. 

x = 1:10:100;
y = [20 30 45 40 60 65 80 75 95 90];
yneg = [1 3 5 3 5 3 6 4 3 3];
ypos = [2 5 3 5 2 5 2 2 5 5];
xneg = [1 3 5 3 5 3 6 4 3 3];
xpos = [2 5 3 5 2 5 2 2 5 5];
errorbar(x,y,yneg,ypos,xneg,xpos,'o')