how to repeat this code for 3 tie intervals??

조회 수: 1 (최근 30일)
SARA Hosseini
SARA Hosseini 2018년 9월 19일
댓글: KALYAN ACHARJYA 2018년 9월 20일
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

채택된 답변

KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 9월 19일
편집: KALYAN ACHARJYA 2018년 9월 19일
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
SARA Hosseini
SARA Hosseini 2018년 9월 20일
Thank you ! :)
KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 9월 20일
My Pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Polynomials에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by