clear; clc; close all;

ho = 0.0;  % initial height (m)
vo = 10.0; % initial velocity (m/s)
a = -9.8;  % gravitational acceleration m/s2
 
h = 1.52;  % find t when we are at this h.

% create a temporary function to use with fsolve
% we need to make a function that has only time
% as its argument.
hsolve = @(t) (height_accelerate(ho,vo,a,t)-h);

t1 = fzero(hsolve,1.0);
t2 = fzero(hsolve,3.0);

% set the polynomial coefficients and
% solve for roots of the polynomial
tt = roots( [a/2,vo,ho-h] )

t = linspace(0,2);
plot(t,height_accelerate(ho,vo,a,t),'k-',...
   tt,height_accelerate(ho,vo,a,tt),'ro',...
   [0,2],ones(2,1)*h,'r-');

xlabel('time (s)');
ylabel('height (m)');