Problem 2 (5 pts)
Recall that the equation for projectile motion when acceleration is constant can be written as
y = y0 + v0t +(a/2)t^2
(2)
Create a spreadsheet to plot y(t). You should be able to easily change the initial velocity, the initial position,
and the acceleration. Be sure to include axis labels as appropriate. The spreadsheet should be easy to use by
anyone.
Problem 3 (5 pts)
Repeat problem 2 using Matlab. Specifically, create a Matlab function called projectile.m that takes y0, v0, a and
a vector of t as arguments.
The function should:
1. Plot y(t) with labeled axes and a grid on the plot.
1
2. Return the vector y(t).
Additional requirement:
Be sure to document your function thoroughly so that when you type “help projectile” Matlab will print
out a message about what the function does and how to use it, along with examples of usage.
part 2)
Part 3)
promt = 'initial value of position';
y_0 = input(prompt);
promt = 'initial value of velocity';
v_0 = input(prompt);
promt = 'acceleration';
a = input(prompt);
t = zeros(1,m);
y = zeros(1,m);
for i = 1:m
{
prompt = 'please insert the time';
t[i] = input(prompt);
y[i] = u_0 + t[i]*v_0 + 0.5*t[i]*a^2
}
plot (t,y);
Get Answers For Free
Most questions answered within 1 hours.