% ex01.m
% Course, Term
% Description
% NAME, Date

clear all;
close all;
clc

% ---- BEGIN DO NOT CHANGE
m     = 500;       % [kg] mass of car 
ks    = 2e5;       % [N/m] spring constant
ys0   = 0.5;       % [m] relaxation height of spring
C     = 3e4;       % [N s / m] damper constant
rho   = 1;         % [kg/m3] density of air
g     = 9.81;      % [m/s^2] gravitational acceleration
Cd    = 0.2;       % [-] drag-coefficient
Ac    = 3;         % [m2] cross-sectional area
% ---- END DO NOT CHANGE

%% question a

% insert answer to question a here

%% question b

% insert answer to question b here

%% question c

% insert answer to question c here

%% question d

return % remove this command when question c is completed.

x0    = 0;         % [m] initial horizontal position
y0    = ys0;       % [m] initial vertical position
u0    = 45;        % [m/s] initial horizontal velocity
v0    = 0;         % [m/s] initial vertical velocity

% create an output array for t
t = linspace(0, 10, 5000);

% obtain Jack's trajectory by calling fJumpingJack
[x y] = fJumpingJack(m, g, ks, ys0, C, @fRamp, rho, Cd, Ac, ...
                     t, x0, y0, u0, v0);

% Note that x and y have the same array size as t, and now resemble Jack's
% position x(t) and y(t).

% plot Jack's trajectory together with the ramp.
figure
plot(x, fRamp(x), 'k', x, y, 'r')
legend('Ramp', 'Jack')