You are on page 1of 3

HW 7 Yutao Liu

I=100; Is=67; ws=6; syms C; J=10;


% x=[p;q;Omega] (r constant)
A=[0 ws*(I-Is)/I C/I;
ws*(Is-I)/I 0 0;
0 0 -C/J]
eig(A)

The roots that I find are neither damped nor dependent on


C. So I cant proceed with the problem.

%football
clear all
m=0.411; Ia=0.0019; It=0.0032; g=9.8;
I=[Ia;It;It];
%a x=[p;q;r;the;psi]
Omega=63;
A=[0 0 0 0 0;
0 0 -Ia*Omega/It 0.325 0;
0 Ia*Omega/It 0 0 0.325;
0 1 0 0 0;
0 0 1 0 0];
eig(A);

%b
J = @(phi,the,psi) [1 tan(the)*sin(phi) tan(the)*cos(phi);
0 cos(phi) -sin(phi);
0 cos(phi)/cos(the) sin(phi)/cos(the)];

T_phi = @(phi) [1 0 0; 0 cos(phi) sin(phi); 0 -sin(phi) cos(phi)];


T_the = @(the) [cos(the) 0 -sin(the); 0 1 0; sin(the) 0 cos(the)];
T_psi = @(psi) [cos(psi) sin(psi) 0; -sin(psi) cos(psi) 0; 0 0 1];
R = @(phi,the,psi) T_phi(phi)*T_the(the)*T_psi(psi);

x=zeros(12,1); %[p;q;r; R;P;Y; u;v;w; X;Y;Z] Z down!


x(5)=40/180*pi; %theta(0)
x(7)=25*cos(30/180*pi); %Vx(0)
x(9)=-25*sin(30/180*pi); %Vz(0)

V = @(x) R(x(4),x(5),x(6))*[x(7);x(8);x(9)];
theV = @(x) atan2(norm(cross(V(x),[1;0;0])),dot(V(x),[1;0;0]));
M = @(x) cross(V(x),[1;0;0])/norm(cross(V(x),[1;0;0]))*theV(x)*3;
F = @(x)
cross([1;0;0],cross(V(x),[1;0;0]))/norm(cross([1;0;0],cross(V(x),[1;0;0
])))*theV(x)*0.325;

sim = @(~,x) [(M(x)-[0;Ia*x(3)*(x(1)+Omega)-It*x(1)*x(3);It*x(1)*x(2)-


Ia*(x(1)+Omega)*x(2)])./I;
J(x(4),x(5),x(6))*[x(1);x(2);x(3)];
(R(x(4),x(5),x(6))*[0;0;g]-F(x))/m;
x(7);x(8);x(9)];

[T,X]=ode45(sim,[0 2.5],x);
figure
plot(atan2(X(:,9),X(:,7)),atan2(X(:,8),X(:,7)));
xlabel('\alpha')
ylabel('\beta')
figure
plot3(X(:,10),X(:,11),-X(:,12));
title('trajectory')
figure
plot(T,X(:,5))
title('\theta(t)')
ylabel('\beta')

1.4

1.2

0.8
-

0.6

0.4

0.2

0
-0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
,
trajectory

2
z

0 30

-1 25
20
-2
15
30
25 10
20
15 5
10 x
5 0
y 0


3(t)
1

0.5

-0.5

-1

-1.5
0 0.5 1 1.5 2 2.5

You might also like