how to repeat this code for 3 tie intervals??

1 visualización (últimos 30 días)
SARA Hosseini
SARA Hosseini el 19 de Sept. de 2018
Comentada: KALYAN ACHARJYA el 20 de Sept. de 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

Respuesta aceptada

KALYAN ACHARJYA
KALYAN ACHARJYA el 19 de Sept. de 2018
Editada: KALYAN ACHARJYA el 19 de Sept. de 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
  2 comentarios
SARA Hosseini
SARA Hosseini el 20 de Sept. de 2018
Thank you ! :)
KALYAN ACHARJYA
KALYAN ACHARJYA el 20 de Sept. de 2018
My Pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Polynomials en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by