How do I calculate acceleration when I have instantaneous values of velocity?
5 ビュー (過去 30 日間)
古いコメントを表示
I have the x, y, and z components of velocity of Uranus 30 days (can also use 1 day apart data) apart since 1800. I want to calculate its acceleration using this velocity data.
I have used the folowing two equations but neither is giving me a result I expect.
5 point differetiation:
h=0.0833; %step size
for i=3:2697 %I have a total of 2699 data points
V1(i,:)=1/(2*h)*(v_u(i-2,:)-8*v_u(i-1,:)+8*v_u(i+1,:)-v_u(i+2,:)); %v_u is the velocity vector of Uranus
end
Derrivative from first principles:
for i=1:2698
X(i)= (V_u(i+1)-V_u(i))./(0.0833); %V_u is the velocity vector of Uranus
end
採用された回答
Wan Ji
2021 年 8 月 21 日
Use pddiff function attached here, this is easy to use.
t = linspace(0,3*pi,19)';
f = sin(t); % assume this is the velocity
[ft_pd, ftt_pd] = pddiff(f, t); % using pddiff method
ft_true = cos(t); % true value
ft_cen = cendiff(f, mean(diff(t)));% using centro diff method
figure(1); clf
plot(t, ft_pd, 'b--');hold on
plot(t, ft_true, 'r-');
plot(t, ft_cen,'k-.');
legend('dfdt-pddiff','dfdt-exact', 'centro-difference')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/717739/image.jpeg)
It is from the picture that pddiff method works fine!
0 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!