Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

2. Write a program with one sub-function to compute the velocity at various time

ID: 644769 • Letter: 2

Question

2. Write a program with one sub-function to compute the velocity at various

time intervals of a body sliding down a slope with an initial velocity, v0. If the

initial velocity, v0 = 5 and acceleration, a = 20:5t + 9:75.

The program should compute the velocity for time [0:5; 10] with increments

of 0.5 seconds.

From calculus: a = dv/dt at t = 0

Output the time and velocity of the object for each time, t.

2. Write a program with one sub-function to compute the velocity at various time intervals of a body sliding down a slope with an initial velocity, v0. If the initial velocity, v0 = 5 and acceleration, a = 20:5t + 9:75. The program should compute the velocity for time [0:5; 10] with increments of 0.5 seconds. From calculus: a = dv/dt at t = 0 Integrate adt between the limits 0 to t Output the time and velocity of the object for each time, t. Integrate dv between the limits v0 to v =

Explanation / Answer

function sliding
% sliding: interactive body velocity
% sliding: interactive computation of the
% sliding velocity of an object
% with second-order drag.
g = 9.81; % acceleration of gravity
m = input('Mass (kg): ');
cd = input('Drag coefficient (kg/m): ');
t = input('Time (s): ');
disp(' ')
disp('Velocity (m/s):')
disp(sqrt(g * m / cd)*tanh(sqrt(g * cd / m) * t))
Save the file as sliding.m. To invoke the function, return to the command window and
type
>> sliding
Mass (kg): 68.1
Drag coefficient (kg/m): 0.25
Time (s): 12
Velocity (m/s):
50.6175

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote