How do I indicate phase changes on my velocity versus time plot on MATLAB?
1 回表示 (過去 30 日間)
古いコメントを表示
I have a graph that plots velocity versus time and I have to indicate where/which data point on the plot accelerates, stays constant, and decelerates. This is what I have for graphing my plot:
>> t = [1.85 2.87 3.78 4.65 5.5 6.32 7.14 7.96 8.79 9.69]
>> d = [10 20 30 40 50 60 70 80 90 100]
>> v = diff(d)./diff(t)
>> plot(v)
>> title('Time versus Velocity for Usain Bolt')
>> xlabel('Time(s)')
>> ylabel('Velocity(m/s)')
>> figure(1)
Can someone please help me?
0 件のコメント
回答 (1 件)
madhan ravi
2021 年 2 月 10 日
t = [1.85 2.87 3.78 4.65 5.5 6.32 7.14 7.96 8.79 9.69];
d = 10: 10 : 100;
v = gradient(d) ./ gradient(t);
figure(1)
dvdt = gradient(v) ./ gradient(t);
%deceleration:
t1 = t(dvdt < 0);
v1 = v(dvdt < 0);
%acceleration:
t2 = t(dvdt > 0);
v2 = v(dvdt > 0);
% P.S :constant part is quite tricky ;)
plot(t, v, '-*k', t1, v1, '-r*', t2, v2, '-g*')
legend({'Constant acceleration', 'Deceleration', 'Acceleration'}, 'location', 'best')
title('Time versus Velocity for Usain Bolt')
xlabel('Time(s)')
ylabel('Velocity(m/s)')
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Numerical Integration and Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!