MATLAB - - Must be programmed and scripted as MATLAB file.
Please return with attached .m file.
See attached file for full problem description.© BrainMass Inc. brainmass.com December 19, 2018, 11:16 pm ad1c9bdddf
Here are two Matlab script files attached.
balle.m answers question 1 and it is essentially your original file with modifications in just a few lines:
max_range_interp1 = interp1(yplot(istep-1:istep+1),xplot(istep-1:istep+1), 0, 'spline') ;
time_flight_interp1 = tau * interp1(yplot(istep-1:istep+1),[istep-2:istep], 0, 'spline') ;
fprintf('Maximum range is %g metersn', max_range_interp1);
fprintf('Time of flight is %g secondsn', time_flight_interp1);
max_range_improvement = max_range_interp1 - r(1)
time_flight_improvement = time_flight_interp1 - istep*tau
balle2.m is modified significantly more, to answer just question 2
In the 2nd script, I have discarded the cumbersome interactive input (if you want to modify parameters, you do it directly in the script).
The result is that the smaller ball is 2.6 meters = 103 inches behind the larger ball when the larger ball hots the ground, which is indeed much more than the 2 inches claimed by Galileo.
I have also changed some notations for easier traceability.
Other explanations are in the comments.
I have explained all the essentials, however if you feel you need more explanations you can ask your questions in the feedback.
Finally, as requested by Brainmasss, I past the texts of the two files below, however you do not need these texts as you have the uploaded files balle.m and balle2.m
Here are the pasted texts:
% balle - Program to compute the trajectory of a baseball
% using the Euler method.
clear; help balle; % Clear memory and print header
%* Set initial ...
The expert examines math and computational physics programming in MATLAB.