Skip to content

Instantly share code, notes, and snippets.

@MShirazAhmad
Created February 5, 2020 07:37
Show Gist options
  • Save MShirazAhmad/b337cfe5fd66afbec17402b80ee9af74 to your computer and use it in GitHub Desktop.
Save MShirazAhmad/b337cfe5fd66afbec17402b80ee9af74 to your computer and use it in GitHub Desktop.
Newton’s Cradle Experiment Using Video Tracking Analysis
load('GOPR0582.mat')
%Mass of Each Ball=66.1g
[Y_min,Index_Y_min] = min(trajectory.tp4.y);
TPy=[trajectory.tp1.y trajectory.tp2.y trajectory.tp3.y trajectory.tp4.y trajectory.tp5.y trajectory.tp6.y trajectory.tp7.y];
TPy=TPy-Y_min;
TPx=[trajectory.tp1.x trajectory.tp2.x trajectory.tp3.x trajectory.tp4.x trajectory.tp5.x trajectory.tp6.x trajectory.tp7.x];
TPx=TPx-TPx(Index_Y_min,4);
TP_Path = sqrt(TPx.^2 + TPy.^2);
for i=1:7
TP_Velocity(:,i) = diff(TP_Path(:,i))./diff(t);
end
KE = (1/2).*(0.061).*TP_Velocity.*TP_Velocity;
Momentum = (0.061).*TP_Velocity;
PE = (0.061).*(9.8).*TPy;
for i=1:7
PE(:,i)=norm2unity(PE(:,i));
end
%% Plots
figure
plot(t(2:2000),norm2unity(TPx(2:2000,1))-1,t(2:2000),norm2unity(TPx(2:2000,7)));
title('The far right ball pulled away and let go')
xlabel('Time')
ylabel('Distance from the mean of the middle ball')
ylim([-1.1 +1])
xlim([0 7])
figure
plot(t(2:2000),norm2unity(KE(2:2000,1)),'--',t(2:2000),norm2unity(KE(2:2000,7)));
title('The far right ball pulled away and let go')
xlabel('Time')
ylabel('K.E of right most and left most spheres')
ylim([0 +1])
xlim([0 7])
figure
plot(t(2:2000),norm2unity(PE(2:2000,1)),'--',t(2:2000),norm2unity(PE(2:2000,7)));
title('The far right ball pulled away and let go')
xlabel('Time')
ylabel('P.E of right most and left most spheres')
ylim([0 +1])
xlim([0 7])
figure
hold on
plot(t(2:2000),norm2unity(KE(2:2000,1)),'--',t(2:2000),norm2unity(KE(2:2000,7)));
plot(t(2:2000),norm2unity(KE(2:2000,1)),'--',t(2:2000),norm2unity(KE(2:2000,7)),t(2:2000),norm2unity(PE(2:2000,1)),'--',t(2:2000),norm2unity(PE(2:2000,7)));
plot(t(2:2000),norm2unity(PE(2:2000,1)),'--',t(2:2000),norm2unity(PE(2:2000,7)));
plot(t(2:2000),norm2unity(KE(2:2000,1))-1,'--',t(2:2000),norm2unity(PE(2:2000,1))-1,t(2:2000),norm2unity(KE(2:2000,7)),'--',t(2:2000),norm2unity(PE(2:2000,7)));
title('The far right ball pulled away and let go')
xlabel('Time (s)')
ylabel('P.E+K.E (normalized)')
xlim([0 7])
ylim([-1.1 +1.1])
title('The far right ball pulled away and let go')
xlabel('Time (s)')
ylabel('P.E+K.E (normalized)')
xlim([0 7])
ylim([-1.1 +1.1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment