Cubic poly trajectory function

7 ビュー (過去 30 日間)
Odesanmi Gbenga Abiodun
Odesanmi Gbenga Abiodun 2022 年 8 月 4 日
コメント済み: Sam Chak 2022 年 8 月 5 日
I am using matlab2018b and I can't use cubicpolytraj function. please what's the alternative function I can use. Thanks

回答 (1 件)

Sam Chak
Sam Chak 2022 年 8 月 4 日
One practical alternative and a mearning way to learn how to generate 3rd-order trajectories is to mathematically derive the 3rd-order polynomical function yourself:
or to use the formula directly:
Say you to get from Point A to Point B in 4 seconds:
t = linspace(0, 4, 401);
A = [2, 3];
B = [5, 7];
x = 2 + (3*(t/4).^2 - 2*(t/4).^3)*(5 - 2);
y = 3 + (3*(t/4).^2 - 2*(t/4).^3)*(7 - 3);
plot(t, [x; y]), ylim([1 8]), grid on,
xlabel('t'), ylabel('Positions'), legend('X-positions','Y-positions')
Or get a 3rd-party MATLAB code from File Exchange.
plot([A(1), B(1)], [A(2), B(2)], 'o'), hold on
plot(x, y), xlim([1 6]), ylim([2 8]), grid on,
xlabel('x'), ylabel('y'),
  2 件のコメント
Odesanmi Gbenga Abiodun
Odesanmi Gbenga Abiodun 2022 年 8 月 5 日
Thanks for your help, please in my case I am having 3x5 points of this example: wapoints = [-0.525;-0.2;0.9],[-0.025;-0.6;0.5], [0.425;-0.3;0.7],[-0.025;-0.55;1.1],[-0.525;-0.2;0.9]]; please can I have a similar example? Thanks
Sam Chak
Sam Chak 2022 年 8 月 5 日
You are welcome, @Odesanmi Gbenga Abiodun. Yes, you can apply exactly the same formula to find the 4 sets of 3rd-order polynomial functions for the five (5) waypoints in 3D {x, y, z} coordinates.
If you find the formula, example, MATLAB code helpful, please consider accepting ✔ and voting 👍 the Answer. Thanks!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeTrajectory Generation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by