Differentiation of altitude and finding time when max v

3 views (last 30 days)
I have a set of data from a spreadsheet with the altitude of rocket at time t the initial altitude is 60m. When i diff(a)/diff(t) for velocity i only get 25 values and i found the maximum velocity now how do i find the time at which it occurs

Accepted Answer

Star Strider
Star Strider on 26 May 2017
Use the gradient function instead of diff to calculate the derivatives. It is the same length as the original vector, so the maximum velocity will correspond to the correct time.
Example
t = linspace(0, 10); % Create Data
a = cos(2*pi*t/max(t)); % Create Data
dt = mean(diff(t));
velocity = gradient(a, dt);
t_max = t(velocity == max(velocity));
figure(1)
plot(t,a, t,velocity)
hold on
plot(t_max,max(velocity),'pg', 'MarkerSize',10, 'MarkerFaceColor','g')
hold off
grid

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!