car - x(1) = 0; % the car starts from x=0 at t=0 for...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
v = [ 0 39.7 55.9 69.5 82.1 91.5]; % the speed data from the table t = [0 4 8 12 16 20]; %the time data from the table n = length(v); % the number of data points deltat = 4; % what is the time between data points?
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: x(1) = 0; % the car starts from x=0 at t=0 for i=1:n-1 % loop to perform the summation x(i+1) = x(i) + (deltat/2)*( v(i+1)-v(i) )+ deltat*v(i) ; end plot(t, x) xlabel('time') ylabel('Distance')...
View Full Document

This note was uploaded on 06/23/2011 for the course ME 218 taught by Professor Unknown during the Fall '08 term at University of Texas.

Ask a homework question - tutors are online