Question
Solution Preview
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.
function Xdot = compute_volleyball_derivatives_starter(~,X)% This function computes the derivatives of the states for a bouncing volleyball.
%
% The input t is time in seconds.
% The input X is our state vector. It has four elements, arranged in a column. Thus it is a 4x1 vector, with four rows, and one column.
% The state vector's first element, X(1), is the horizontal position of the ball, in meters.
% The state vector's second element, X(2), is the vertical position of the ball, in meters.
% The state vector's third element, X(3), is the horizontal velocity of the ball, in meters per second.
% The state vector's fourth element, X(4), is the vertical velocity of the ball, in meters per second.
% Declare global variables.
global BallMass g;
global FloorPositionY FloorStiffness FloorDamping;
% Pull components from the input state vector X to make them easier to use below.
x = X(1);
y = X(2);
vx = X(3);
vy = X(4);
% Calculate the time derivatives of each state from the current states.
% For now make the ball move at constant velocity. You will update this!
xdot = vx;
ydot=vy;
if y > FloorPositionY
vxdot = 0;
vydot=-g;
end...