For end loop for acceleration

조회 수: 6 (최근 30일)
Paisley Simpson
Paisley Simpson 2019년 2월 21일
편집: Omer Yasin Birey 2019년 2월 21일
i have a table of various data, and need to find the acceleration of a car using the time and speed columns, how exactly do i do this please, using a for end loop.

답변 (1개)

Omer Yasin Birey
Omer Yasin Birey 2019년 2월 21일
편집: Omer Yasin Birey 2019년 2월 21일
I don't know why you want to write the code with for loop but this might work.
time = yourTime;
dt = diff(time)
v = yourSpeed;
dv = diff(v)
a = zeros(length(dv),1);%acceleration
for i = 1:length(time)-1
a(i) = dv(i)./dt(i)
end
But better you use
a= dv./dt;

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by