Plotting Error Bars (Uncertainties) for Scatter Plot Points
7 views (last 30 days)
Show older comments
Shown in my code below, I am calculating a vector of drag coefficients and a vector Reynolds number, and then a calculation of their uncertainties (i.e., Re+/-unc). How do I plot the vertical and horizontal error bars representing the vectors I have calculated below in the code (u_C_D and u_Re). C_D is the y-variable, Re is the x-variable, so u_CD error bars need to be going vertical, and the u_Re error bars need to be horizontal.
Thanks!
V = [5,6,7,8,9,10,11,12,13,14,15]; % Velocity Data in m/s
F = [8.6,11.8,15.9,20.5,25.5,31.4,37.9,45.2,53.5,61.3,70.4]; % Drag Force in mN
p = 1.16; % Density in kg/m^3
D = 25; % Diameter of Disk in mm
m = 18.4e-6; % Viscosity in Ns/m^2
uV = 0.3; % Velocity uncertainty in m/s
uF = 0.1; % Force uncertainty in mN
up = 0.01; % Density uncertainty in kg/m^3
uD = 0.05; % Diameter uncertainty in mm
um = 0.1e-6; % Viscosity uncertainty in Ns/m^2
Re = p*V*D*10^-3/m; % Calculation of Reynolds Numbers
CD = 2*F*10^-3./(p*V.^2*pi/4*(D*10^-3)^2); % Calculation of Drag Coefficients
% Calculation of uncertainties in C_D and Re
uRe = Re.*sqrt((up/p)^2+(uV./V).^2+(uD/D)^2+(um/m)^2);
uCD = CD.*sqrt((uF./F).^2+(up/p)^2+(2*uV./V).^2+(2*uD/D)^2);
figure(1)
plot(Re,CD,'*')
grid on
xlabel('Drag Coefficient, C_D');
ylabel('Reynolds Number, R_e');
0 Comments
Answers (1)
See Also
Categories
Find more on Scatter Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!