how to repeat this code for 3 tie intervals??

3 Ansichten (letzte 30 Tage)
SARA Hosseini
SARA Hosseini am 19 Sep. 2018
Kommentiert: KALYAN ACHARJYA am 20 Sep. 2018
this code is to find the coefficinets of the third order polynomial in a motion planning: function x=pol3interpol(tk,tk1,qk,qk1,dotqk,dotqk1)
A=[1,tk,tk^2,tk^3; 1,tk1,tk1^2,tk1^3; 0,1,2*tk,3*tk^2; 0,1,2*tk1,3*tk1^2];
C=[qk,qk1,dotqk,dotqk1]';
x=inv(A)*C; where: % qk initial joint position % qk1 final joint position % dotqk initial joint speed % dotqk1 final joint speed % tk=initial time % tk1=final time
I can find the values of the coefficines a0, a1,a2,a3 by this code. but how can I repeat it for 3 times for the values above?
q0=[0 2 5];% Initial position qk1=[2 5 0];% Final position dotqk=[0 0 0];% Initial velocity dotqk1=[0 0 0];% Final velocity tk=[0 2 4]; % Initial time tk1=[2 4 6];% Final time

Akzeptierte Antwort

KALYAN ACHARJYA
KALYAN ACHARJYA am 19 Sep. 2018
Bearbeitet: KALYAN ACHARJYA am 19 Sep. 2018
A=[1,tk,tk^2,tk^3; 1,tk1,tk1^2,tk1^3; 0,1,2*tk,3*tk^2; 0,1,2*tk1,3*tk1^2];
C=[qk,qk1,dotqk,dotqk1]';
for i=1:3
x=inv(A)*C
end

Weitere Antworten (0)

Kategorien

Mehr zu Polynomials finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by