In: Physics
matlab
use matlab to calculate the velocity of the
vertical falling ball (v) as a function of time by numerical
derive the following measurement values.(x is height in meters and
y is the landing time in milliseconds) Make sure that the speed in
the starting point is 0. Then reset
instantaneous velocity as a function of time in a diagram
with matlab
x=[0.00 0.20 0.40 0.60 0.80 1.00 1.20 1.50 2.00 2.50 3.00 3.40 3.80 4.20 4.60 5.0]
y=[[0.00 1.620 2.937 3.635 4.217 4.800 5.377 6.013 7.226 8.259 9.219 9.999 10.751 11.455 12.170 12.882]
please write the matlab code with explaination so i can understand it better, thankd in advance!!
This is the Matlab code to calculate velocity of vertical falling ball. I am commenting in this code,so you can easily understand. we use percentage sign for commenting in Matlab.
START
x=[0.00 0.20 0.40 0.60 0.80 1.00 1.20 1.50 2.00 2.50 3.00 3.40 3.80 4.20 4.60 5.0]; % array of height
y=[0.00 1.620 2.937 3.635 4.217 4.800 5.377 6.013 7.226 8.259 9.219 9.999 10.751 11.455 12.170 12.882]; % time
k=y*(.001); % time in second
z= zeros(1,16); % initialize array of velocity
% we divide the both array to get velocity (velocity= distance/ time)
% we start from index 2 because index 1 is undefined
for i=2:16
z = x./k;
end
z(1)=0; % zero speed at starting point
disp(z); % array of velocity
% velocity is in meter/second
END