For end loop for acceleration
1 回表示 (過去 30 日間)
古いコメントを表示
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.
0 件のコメント
回答 (1 件)
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;
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!