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

Problem 4 (12 Points)-MATLAB and Flow Chart A ball starts at a height ho above t

ID: 2074734 • Letter: P

Question

Problem 4 (12 Points)-MATLAB and Flow Chart A ball starts at a height ho above the surface of the Earth with a vertical velocity vo, the position and velocity as a function of the time will be given by the equations r(t) = gt + Vo Where gis the acceleration due to gravity (-9.81 m/s), h is the height above the ground, and v is the vertical component of the velocity. In addition, t is an array that goes from 0 to 2 seconds in increments of 0.01 seconds. With that said, write a code that does the following (flow chart for the code as well): Ask the user the initial height and velocity. Make sure the entries make sense in the real world. If they do not make sense terminate the code using "return" After it has been determined that the initial height and velocity make sense, calculate the position and velocity of the ball for all the values of t. Check if the position at any time is less than zero. o If the position is never less than zero (h20), plot h(t) vs. t and you are done If the position is ever less than zero, Find when the height goes below zero. Once you find the index when h(t)

Explanation / Answer

% Matlab code for above problem

clc
clear all
close all
h0= input('initial height');
v0= input('initial velocity');

if h0<=0 && v0<=0
warning('initial data given are not real')
return
end
g=-9.81;
t=0:0.01:2;
h=(0.5*g*t.^2)+(v0*t)+(h0);
% h(h<0)=0;
c= find(h<0);
h(c)=0;
v=(g*t)+v0;
plot(t,h)
xlabel('time(t)')
ylabel('height(h)')

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