Plotting Error Bars (Uncertainties) for Scatter Plot Points

6 vues (au cours des 30 derniers jours)
N/A
N/A le 17 Sep 2015
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');

Réponses (1)

Star Strider
Star Strider le 17 Sep 2015
Search the File Exchange for the error bar contribution that most closely meets your needs.

Catégories

En savoir plus sur Scatter Plots dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by