![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/180915/image.jpeg)
How can I calculate the acceleration if I know the time and the displacement ?
31 ビュー (過去 30 日間)
古いコメントを表示
Dragos Dascalu
2018 年 4 月 5 日
コメント済み: Pawel Jastrzebski
2018 年 4 月 5 日
I have a column with the exact time of each measurement, and a column with a distance between a sensor and a reflective surface. By taking the difference between two consecutive measurements I can have the time between the two and the displacement (negative or positive). How can I calculate the displacement using the derivative function ?
t1=0.2; t2=0.4;
t=t2-t1; %%%%time period
h1=150; h2=160;
d=h2-h1; %%%%%displacement v=... ? a= ... ?
0 件のコメント
採用された回答
Pawel Jastrzebski
2018 年 4 月 5 日
編集済み: Pawel Jastrzebski
2018 年 4 月 5 日
Consider the following example:
t = 1:10;
h = t.^2;
dt = diff(t)
dh = diff(h)
% v - velocity
v = dh./dt
dv = diff(v)
% a - acceleration
a = dv./dt(2:end)
plot(t,h,'-ob');
hold on;
plot(t(2:end),v,'-og');
plot(t(3:end),a,'-or');
legend({'h', 'v','a'})
Outcome:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/180915/image.jpeg)
2 件のコメント
Pawel Jastrzebski
2018 年 4 月 5 日
It's just an example. I use t as the time vector and also because it's simply a vector of numbers so I used it to create the h vector of the displacement values growing exponentially. But long story short, h can be anything. In your case, use the vectors you were given.
その他の回答 (0 件)
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!