Skip to content

Instantly share code, notes, and snippets.

@MShirazAhmad
Created February 5, 2020 07:00
Show Gist options
  • Save MShirazAhmad/1d3bd299b6837e4c449a4ef122fb340f to your computer and use it in GitHub Desktop.
Save MShirazAhmad/1d3bd299b6837e4c449a4ef122fb340f to your computer and use it in GitHub Desktop.
Script_Plot_With_Unc
%% Energy COnservation in Two Dimensions
h = (75 + 1.9);
L = (29.5 + 1.9 + 0.95);
%% Experimental Data
Theta = [20 25 30 35 40 45]; %
d = [19.4 25.9 32.5 38.2 43.5 51]+3;
x=(d.^2)./(4*h*L);
Ux = (d.^2)./(4*h*L);
y=(1 - cosd(Theta));
Uy = sind(Theta).*(0.01745);
Unc = Ufraction((d.^2),Umult(d,0.2,d,0.2),(4*h*L),Umult(h,0.2,L,0.2));
%% Theoretical Data
ThetaT=20:45;
dT = 2.*sqrt(76.9.*32.35.*(1-cosd(ThetaT)));
xT=(dT.^2)./(4*h*L);
yT=(1 - cosd(ThetaT));
%% Plots
errorbar(x,y,Unc,Uy,'LineWidth',1)
hold on
plot(xT,yT,'LineWidth',1)
axis([0.04 0.3 0.05 0.32])
xlabel('d^2/4hL')
ylabel('1 - cos(\theta)')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment