euler angles, method of direction cosines and quaternions for alpha = 30,45,60 deg

조회 수: 3 (최근 30일)
srina nair
srina nair 2015년 5월 29일
댓글: srina nair 2015년 5월 29일
clc;
alpha = 45
omega = 30
lam = 0.0001
p = omega*cos(alpha)
q = 0
r = omega*sin(alpha)
%%integration equations from pg 356
%%method of direction cosines
c11=1
c12=0
c13=0
c21=0
c22=1
c23=0
c31=0;
c32=0
c33=1
cd11=c12*r-c13*q
cd12=c12*p-c11*r
cd13=c11*q-c12*p
cd21=c22*r-c23*q
cd22=c23*q-c21*r
cd23=c12*q-c22*p
cd31=c32*r-c33*q
cd32=c33*p-c13*r
cd33=c31*q-c32*p
theta = asind(-c31)
phi = acosd((c33/sqrt(1-(c31^2)))*c32)
psi = acosd((c11/sqrt(1-(c31^2)))*c21)
%%Euler angles
phid=p+r*tan(theta)*cos(phi);
thetad=-r*sind(phi)
psid=r*sec(theta)*cos(phi)
%%quaternions
e0 = cos(psi/2)*cos(theta/2)*cos(phi/2)+sin(psi/2)*sin(theta/2)*sin(phi/2)
e1 = cos(psi/2)*cos(theta/2)*sin(phi/2)-sin(psi/2)*sin(theta/2)*cos(phi/2)
e2 = cos(psi/2)*sin(theta/2)*cos(phi/2)+sin(psi/2)*cos(theta/2)*sin(phi/2)
e3 = -cos(psi/2)*sin(theta/2)*sin(phi/2)+sin(psi/2)*cos(theta/2)*cos(phi/2)
E= 1-(e0^2+e1^2+e2^2+e3^2)
ed0=(-1/2)*(e1*p+e2*q+e3*r)+lam*E*e0
ed1=(1/2)*(e0*p+e2*r-e3*q)+lam*E*e1
ed2=(1/2)*(e0*q+e3*p-e1*r)+lam*E*e2
ed3=(1/2)*(e0*r+e1*q-e2*p)+lam*E*e3

답변 (1개)

James Tursa
James Tursa 2015년 5월 29일
편집: James Tursa 2015년 5월 29일
What is your question? If you want to check conversions between quaternions, direction cosine matrices, and Euler angles, I would suggest this FEX submission by John Fuller:
Also, review this tutorial:
  댓글 수: 1
srina nair
srina nair 2015년 5월 29일
I am unable to get the graph. i want to know how to perform ode45 to integrate phid in the above coding

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

Community Treasure Hunt

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

Start Hunting!

Translated by