Spacecraft Dynamics: MRPs for Yaw
Spacecraft Dynamics: MRPs for Yaw
Objective:
Introduction:
- Introduce Modified Rodrigues Parameters (MRPs) as a method for representing the orientation of a
Spacecraftor spacecraft.
- Explain the significance of yaw, along with pitch and roll, in the context of spacecraft or
Spacecraftdynamics.
- Discuss the importance of numerical integration in solving ODEs that describe rotational motion.
Theory:
- Present the mathematical formulation of MRPs and their relationship with the angular velocity of a
rigid body.
- Derive the ODEs governing the motion in terms of MRPs, focusing on the yaw angle.
- Outline the numerical integration method (e.g., Runge-Kutta) used to solve the ODEs.
Apparatus/Software:
Procedure:
Formulate the system of ODEs describing the dynamics of the Spacecraftusing MRPs, with an
emphasis on the yaw angle.
Specify initial conditions for yaw, pitch, and roll using MRPs, as these will influence the resulting
motion.
3. Numerical Integration:
Use MATLAB’s ODE solver (e.g., `ode45`) to integrate the equations over the chosen time interval.
4. Plotting Yaw:
Extract and plot the yaw angle over time from the integrated results.
5. 3D Visualization:
Visualize the 3D motion of the Spacecraftor spacecraft using MATLAB’s `plot3` function, showing
the evolution of yaw, pitch, and roll.
6. Analysis:
Analyze the results, focusing on the behavior of the yaw angle and the overall 3D motion. Discuss
the influence of initial conditions and any numerical issues encountered.
Results:
Discussion:
- Discuss how the initial conditions and integration parameters affect the yaw angle and the overall
trajectory.
- Consider the accuracy and stability of the numerical integration process, and comment on the
effectiveness of MRPs in representing rotational dynamics.
Conclusion:
- Summarize the key findings, particularly regarding the behavior of the yaw angle and the utility of
MRPs in modeling rotational motion.
```matlab
dydt = zeros(3,1);
sigma = y; % MRPs
end
function S = skew(v)
v(3) 0 -v(1);
-v(2) v(1) 0 ];
end
figure;
plot(t, y(:,1)); % assuming y(:,1) corresponds to the MRP component related to yaw
xlabel('Time (s)');
grid on;
% 3D Visualization of the resulting motion
figure;
xlabel('MRP1');
ylabel('MRP2');
zlabel('MRP3');
grid on;
axis equal;
```
Output:
2. Numerical Integration of ODE Functions Using Modified Rodrigues Parameters for
Pitch and 3D Visualization of SpacecraftMotion
Objective:
Introduction:
- Explain the significance of pitch, along with yaw and roll, in the dynamics of a rigid body.
- Discuss the importance of numerical integration for solving ODEs that describe rotational motion.
Theory:
- Present the mathematical formulation of MRPs and how they relate to the angular velocity of a rigid
body.
- Derive the ODEs governing the motion using MRPs, with a focus on the pitch angle.
- Explain the numerical integration method (e.g., Runge-Kutta) used to solve these ODEs.
Apparatus/Software:
Procedure:
Formulate the system of ODEs that describe the dynamics of the Spacecraftusing MRPs, focusing
on the pitch angle.
Set initial conditions for pitch, yaw, and roll using MRPs, as these will determine the motion of the
rigid body.
3. Numerical Integration:
Apply MATLAB’s ODE solver (e.g., `ode45`) to integrate the equations over the specified time
period.
4. Plotting Pitch:
Extract and plot the pitch angle over time from the integrated results.
5. 3D Visualization:
Visualize the 3D motion of the Spacecraftor spacecraft using MATLAB’s `plot3` function, showing
the evolution of pitch, yaw, and roll.
6. Analysis:
Analyze the results, focusing on the behavior of the pitch angle and the overall 3D motion. Discuss
the influence of initial conditions and any numerical issues encountered.
Results:
Discussion:
- Discuss how the initial conditions and integration parameters affect the pitch angle and the overall
trajectory.
- Comment on the accuracy and stability of the numerical integration process, and the effectiveness of
MRPs in representing rotational dynamics.
Conclusion:
- Summarize the key findings, particularly regarding the behavior of the pitch angle and the utility of
MRPs in modeling rotational motion.
```matlab
dydt = zeros(3,1);
sigma = y; % MRPs
end
function S = skew(v)
v(3) 0 -v(1);
-v(2) v(1) 0 ];
end
figure;
plot(t, y(:,2)); % assuming y(:,2) corresponds to the MRP component related to pitch
xlabel('Time (s)');
figure;
xlabel('MRP1');
ylabel('MRP2');
zlabel('MRP3');
grid on;
axis equal;
```
Output:
3. Numerical Integration of ODE Functions Using Modified Rodrigues Parameters for
Roll and 3D Visualization of SpacecraftMotion
Objective:
Introduction:
- Introduce Modified Rodrigues Parameters (MRPs) as an efficient method for representing the
rotational dynamics of a Spacecraftor spacecraft.
- Explain the significance of roll, along with pitch and yaw, in the overall orientation of a rigid body.
- Discuss the importance of numerical integration in solving ODEs that describe such rotational
motion.
Theory:
- Provide a mathematical background of MRPs and their relation to angular velocity and
Spacecraftmotion.
- Derive the ODEs governing the motion using MRPs, emphasizing the roll component.
- Explain the numerical integration technique (e.g., Runge-Kutta method) used to solve these ODEs.
Apparatus/Software:
Procedure:
Formulate the system of ODEs using MRPs that describe the rigid body's dynamics, focusing on the
roll angle.
Set the initial conditions for yaw, pitch, and roll using MRPs.
3. Numerical Integration:
Use MATLAB’s ODE solver (e.g., `ode45`) to integrate the ODEs over a given time period.
4. Plotting Roll:
Extract and plot the roll angle over time from the integrated results.
5. 3D Visualization:
Visualize the rigid body's 3D motion using MATLAB’s `plot3` function to show the trajectory of
the yaw, pitch, and roll parameters.
6. Analysis:
Analyze the results, focusing on the roll dynamics and the 3D motion of the rigid body. Discuss any
trends, behaviors, or numerical issues encountered.
Results:
- Provide a 3D plot showing the rigid body's or spacecraft's trajectory using MRPs.
Discussion:
- Discuss the impact of the initial conditions on the roll angle and the overall motion.
- Address the stability and accuracy of the numerical integration process, commenting on the
effectiveness of MRPs in describing rotational motion.
Conclusion:
- Summarize the key outcomes, particularly the behavior of the roll angle and the application of MRPs
in rotational dynamics.
```matlab
dydt = zeros(3,1);
sigma = y; % MRPs
end
function S = skew(v)
v(3) 0 -v(1);
-v(2) v(1) 0 ];
end
figure;
plot(t, y(:,3)); % assuming y(:,3) corresponds to the MRP component related to roll
xlabel('Time (s)');
grid on;
% 3D Visualization of the resulting motion
figure;
xlabel('MRP1');
ylabel('MRP2');
zlabel('MRP3');
grid on;
axis equal;
```
Output:
4. Numerical Integration of ODE Functions Using Stereographic Projections for Yaw and
3D Visualization of SpacecraftMotion
Objective:
Introduction:
- Briefly explain the concept of stereographic projections and their significance in representing
rotational motion.
- Describe the role of numerical integration in solving ODEs and its application in simulating the
motion of a rigid body.
Theory:
- Explain the method of numerical integration (e.g., Runge-Kutta method) used in the experiment.
Apparatus/Software:
Procedure:
Define the system of ODEs representing the stereographic projections of the Spacecraft motion.
Set the initial conditions for the state variables (e.g., initial yaw, pitch, and roll angles).
3. Numerical Integration:
Use MATLAB's ODE solver (e.g., `ode45`, `ode23`) to perform the numerical integration over the
specified time interval.
4. Plotting Yaw:
Extract the yaw angle from the integrated state variables and plot it as a function of time.
5. 3D Visualization:
Visualize the 3D motion of the Spacecraftusing MATLAB's `plot3` or similar functions, showing
the trajectory in space.
6. Analysis:
Analyze the results, discuss the accuracy and stability of the numerical integration, and interpret the
physical meaning of the yaw angle and 3D trajectory.
Results:
Discussion:
- Discuss how the initial conditions and parameters affect the yaw and 3D motion.
Conclusion:
```matlab
dydt = zeros(3,1);
figure;
xlabel('Time (s)');
grid on;
figure;
xlabel('Yaw');
ylabel('Pitch');
zlabel('Roll');
grid on;
axis equal;
Output:
5. Numerical Integration of ODE Functions Using Stereographic Projections for Pitch and
3D Visualization of SpacecraftMotion
Objective:
Introduction:
- Discuss the importance of pitch, yaw, and roll in the context of spacecraft or Spacecraftmotion.
- Introduce numerical integration as a method to solve ODEs that describe the system's behavior over
time.
Theory:
- Derive the mathematical equations of stereographic projections for a rotating rigid body.
- Formulate the ODEs governing the motion in terms of pitch, yaw, and roll.
- Explain the method used for numerical integration (e.g., Runge-Kutta) and its significance in this
context.
Apparatus/Software:
Procedure:
Formulate the system of ODEs that describe the stereographic projection, focusing on the pitch
angle.
Choose initial conditions for pitch, yaw, and roll angles, which will influence the resulting motion.
3. Numerical Integration:
Apply MATLAB’s ODE solver (e.g., `ode45`) to integrate the equations over the desired time
period.
4. Plotting Pitch:
Extract and plot the pitch angle over time from the integrated solution.
5. 3D Visualization:
Visualize the Spacecraftor spacecraft's trajectory in 3D using MATLAB’s `plot3` function, showing
the evolution of pitch, yaw, and roll.
6. Analysis:
Discuss the results, focusing on the behavior of the pitch angle and the overall 3D motion. Analyze
any trends or patterns observed in the data.
Results:
Discussion:
- Discuss the impact of initial conditions on the pitch and overall motion.
Conclusion:
- Summarize the key outcomes, including the behavior of the pitch angle and the effectiveness of
stereographic projections in representing the motion.
```matlab
% Define the ODE function for stereographic projections with a focus on pitch
dydt = zeros(3,1);
end
% Set initial conditions (yaw, pitch, roll)
figure;
xlabel('Time (s)');
grid on;
figure;
xlabel('Yaw');
ylabel('Pitch');
zlabel('Roll');
grid on;
axis equal;
```
Output:
6. Numerical Integration of ODE Functions Using Stereographic Projections for Roll and
3D Visualization of SpacecraftMotion
Objective:
Introduction:
- Explain the significance of roll, along with yaw and pitch, in describing the orientation of a
Spacecraftor spacecraft.
- Discuss the necessity of numerical integration in solving ODEs for dynamic systems.
Theory:
- Derive the ODEs that describe the motion, focusing on the roll angle.
- Outline the numerical integration method used (e.g., Runge-Kutta) and its application to solving
these ODEs.
Apparatus/Software:
Procedure:
Formulate the system of ODEs describing the stereographic projection, particularly emphasizing the
roll angle.
Specify initial conditions for yaw, pitch, and roll, as these will influence the motion of the rigid
body.
3. Numerical Integration:
Utilize MATLAB’s ODE solver (e.g., `ode45`) to integrate the equations over the selected time
interval.
4. Plotting Roll:
Extract and plot the roll angle over time from the solution of the ODEs.
5. 3D Visualization:
6. Analysis:
Analyze the results, focusing on the behavior of the roll angle and the overall 3D motion of the
system. Discuss any patterns or anomalies observed.
Results:
Discussion:
- Discuss how initial conditions and parameters affect the roll angle and the overall trajectory.
- Consider the accuracy and stability of the numerical integration process and any potential sources of
error.
Conclusion:
- Summarize the key findings, particularly focusing on the behavior of the roll angle and the
usefulness of stereographic projections in this context.
```matlab
% Define the ODE function for stereographic projections with a focus on roll
dydt = zeros(3,1);
figure;
xlabel('Time (s)');
grid on;
figure;
xlabel('Yaw');
ylabel('Pitch');
zlabel('Roll');
grid on;
axis equal;
```
Output:
7. Numerical Integration of ODE Functions of Cayley-Klein Parameters plotting the yaw
angle motion and Visualization of Spacecraft Motion
Objective:
Theory:
The Cayley-Klein parameters are used in representing rotations in three-dimensional space. These
parameters are particularly useful in aerospace applications for representing the orientation of
spacecraft. This experiment involves the numerical integration of the ODEs associated with these
parameters and analyzing the resulting motion.
- MATLAB software
Procedure:
- Open MATLAB.
- Write the system of ODEs representing the Cayley-Klein parameters. These equations govern the
rotational dynamics of the spacecraft.
3. Numerical Integration:
- Implement the numerical integration using MATLAB's built-in functions like `ode45` or `ode23`.
- Define the time span over which the integration will be performed.
5. 3D Visualization:
- Use the integrated Cayley-Klein parameters to calculate the orientation of the spacecraft over time.
- Use MATLAB's plotting functions such as `plot3`, `quiver3`, or `surf` to visualize the spacecraft's
orientation and motion.
6. Analysis:
- Analyze the plots and the 3D visualization to understand the behavior of the spacecraft.
7. Conclusion:
MATLAB Code:
dydt = zeros(4,1);
end
tspan = [0 10];
% Extract yaw angle (Example: assuming yaw = atan2(2(q1q4 + q2q3), 1 - 2(q3^2 + q4^2)))
figure;
plot(t, yaw);
xlabel('Time (s)');
figure;
for i = 1:length(t)
clf;
% Define the spacecraft's body frame axes (example: a unit vector along the x-axis)
rotated_vector = R body_frame;
axis equal;
axis([-1 1 -1 1 -1 1]);
grid on;
xlabel('X');
ylabel('Y');
zlabel('Z');
pause(0.1);
end
Results:
Conclusion:
Summarize the key results and observations from the experiment, highlighting any significant
conclusions regarding the spacecraft's rotational dynamics.
Questions:
1. What role do the Cayley-Klein parameters play in the representation of rotational dynamics?
2. How does the yaw angle behave over time based on the integration results?
Objective:
Theory:
- MATLAB software
Procedure:
- Open MATLAB.
- Write the system of ODEs representing the Cayley-Klein parameters, which govern the rotational
dynamics of the spacecraft.
3. Numerical Integration:
- Implement the numerical integration using MATLAB's built-in functions like `ode45`.
- Define the time span over which the integration will be performed.
5. 3D Visualization:
- Use the integrated Cayley-Klein parameters to calculate the orientation of the spacecraft over time.
- Use MATLAB's plotting functions such as `plot3`, `quiver3`, or `surf` to visualize the spacecraft's
orientation and motion.
6. Analysis:
- Analyze the plots and the 3D visualization to understand the behavior of the spacecraft.
7. Conclusion:
MATLAB Code:
dydt = zeros(4,1);
end
tspan = [0 10];
figure;
plot(t, pitch);
xlabel('Time (s)');
figure;
for i = 1:length(t)
clf;
% Define the spacecraft's body frame axes (example: a unit vector along the x-axis)
rotated_vector = R body_frame;
axis equal;
axis([-1 1 -1 1 -1 1]);
grid on;
xlabel('X');
ylabel('Y');
zlabel('Z');
pause(0.1);
end
Results:
Discussion:
Conclusion:
Summarize the key results and observations from the experiment, highlighting any significant
conclusions regarding the spacecraft's rotational dynamics.
Questions:
1. What role do the Cayley-Klein parameters play in the representation of rotational dynamics?
2. How does the pitch angle behave over time based on the integration results?
Objective:
Theory:
The Cayley-Klein parameters are a set of four parameters that can represent the orientation of a
Spacecraftin three-dimensional space. These parameters are particularly useful in aerospace
applications for describing the rotation and orientation of spacecraft. This experiment focuses on
solving the ODEs related to the Cayley-Klein parameters, analyzing the behavior of the roll angle
over time, and visualizing the spacecraft's motion in 3D.
- MATLAB software
Procedure:
- Open MATLAB.
- Write the system of ODEs representing the Cayley-Klein parameters. These equations govern the
rotational dynamics of the spacecraft.
3. Numerical Integration:
- Implement the numerical integration using MATLAB's built-in functions like `ode45`.
- Define the time span over which the integration will be performed.
- Use the integrated Cayley-Klein parameters to calculate the orientation of the spacecraft over time.
- Use MATLAB's plotting functions such as `plot3`, `quiver3`, or `surf` to visualize the spacecraft's
orientation and motion.
6. Analysis:
- Analyze the plots and the 3D visualization to understand the behavior of the spacecraft.
7. Conclusion:
MATLAB Code:
dydt = zeros(4,1);
end
tspan = [0 10];
% Extract roll angle (Example: assuming roll = atan2(2(q1q2 + q3q4), 1 - 2(q2^2 + q3^2)))
figure;
plot(t, roll);
xlabel('Time (s)');
figure;
for i = 1:length(t)
clf;
% Define the spacecraft's body frame axes (example: a unit vector along the x-axis)
rotated_vector = R body_frame;
axis equal;
axis([-1 1 -1 1 -1 1]);
grid on;
xlabel('X');
ylabel('Y');
zlabel('Z');
pause(0.1);
end
Results:
Discussion:
Conclusion:
Summarize the key results and observations from the experiment, highlighting any significant
conclusions regarding the spacecraft's rotational dynamics.
Questions:
1. What role do the Cayley-Klein parameters play in the representation of rotational dynamics?
2. How does the roll angle behave over time based on the integration results?
1. Introduction
This lab aims to numerically integrate the equations of motion using Euler angles to describe the
attitude dynamics of a spacecraft. The focus will be on plotting the roll angle over time and
visualizing the spacecraft’s 3D motion based on these Euler angles.
2. Objectives
- To understand the use of Euler angles (yaw, pitch, roll) in representing spacecraft orientation.
- To plot the roll angle over time from the integrated data.
3. Theory
Euler angles describe the orientation of a rigid body in space using three angles: yaw (rotation about
the z-axis), pitch (rotation about the y-axis), and roll (rotation about the x-axis). The dynamic
equations for Euler angles describe how these angles evolve based on the body’s angular velocity
components ( p ), ( q ), and ( r ).
4. Apparatus/Software
- MATLAB
Specify the angular velocities ( p ), ( q ), and ( r ) in the body frame of the spacecraft.
Use MATLAB’s `ode45` solver to numerically integrate the equations of motion for Euler angles
over a time span.
Plot the roll angle \( \phi \) as a function of time to observe how it evolves during the spacecraft’s
motion.
Use the Euler angles to create a 3D visualization of the spacecraft’s orientation during its motion.
6. Observations
Discuss the behavior of the roll angle and how Euler angles provide a convenient means of
representing and visualizing the spacecraft's orientation.
---
MATLAB Example Code: Numerical Integration of Euler Angles for Roll and 3D Visualization
```matlab
% Time span
roll = euler(1);
pitch = euler(2);
0, cos(roll), -sin(roll);
0, sin(roll)/cos(pitch), cos(roll)/cos(pitch)];
end
roll = euler(:,1);
figure;
plot(t, roll);
title('Roll vs Time');
xlabel('Time (s)');
ylabel('Roll (rad)');
figure;
for i = 1:length(t)
roll = euler(i,1);
pitch = euler(i,2);
yaw = euler(i,3);
axis equal;
grid on;
pause(0.1);
hold off;
end
function R = eul2rotm(eul)
Rz = [cos(yaw), -sin(yaw), 0;
sin(yaw), cos(yaw), 0;
0, 0, 1];
Ry = [cos(pitch), 0, sin(pitch);
0, 1, 0;
-sin(pitch), 0, cos(pitch)];
Rx = [1, 0, 0;
0, cos(roll), -sin(roll);
0, sin(roll), cos(roll)];
R = Rz Ry Rx;
end
```
Output:
This MATLAB code performs the numerical integration of Euler angle kinematic equations,
computes the roll angle, and generates a 3D visualization of the spacecraft's orientation over time.
11. Numerical Integration of ODE Functions of Euler ANGLES for PITCH and 3D
Visualization of Spacecraft Motion
1. Introduction
This lab focuses on numerically integrating the equations of motion using Euler angles to describe the
spacecraft's attitude dynamics. Specifically, it involves plotting the pitch angle over time and
visualizing the spacecraft's 3D motion based on Euler angles.
2. Objectives
- To understand the use of Euler angles (yaw, pitch, roll) in representing spacecraft orientation.
- To plot the pitch angle over time from the integrated data.
3. Theory
Euler angles describe the orientation of a rigid body in space using three angles: yaw (rotation about
the z-axis), pitch (rotation about the y-axis), and roll (rotation about the x-axis). The dynamic
equations for Euler angles describe how these angles evolve based on the body’s angular velocity
components ( p ), ( q ), and ( r ).
4. Apparatus/Software
- MATLAB
Specify the angular velocities ( p ), ( q ), and ( r ) in the body frame of the spacecraft.
Use MATLAB’s `ode45` solver to integrate the equations of motion for Euler angles over a
specified time span.
From the integrated solution, extract and plot the pitch angle \( \theta \) as a function of time.
Use the Euler angles to generate a 3D visualization of the spacecraft’s orientation over time.
6. Observations
Discuss the evolution of the pitch angle and how Euler angles offer a practical way to represent and
visualize the spacecraft’s attitude.
---
MATLAB Example Code: Numerical Integration of Euler Angles for Pitch and 3D Visualization
```matlab
% Time span
roll = euler(1);
pitch = euler(2);
0, sin(roll)/cos(pitch), cos(roll)/cos(pitch)];
end
pitch = euler(:,2);
figure;
plot(t, pitch);
title('Pitch vs Time');
xlabel('Time (s)');
ylabel('Pitch (rad)');
figure;
for i = 1:length(t)
roll = euler(i,1);
pitch = euler(i,2);
yaw = euler(i,3);
axis equal;
grid on;
pause(0.1);
hold off;
end
function R = eul2rotm(eul)
Rz = [cos(yaw), -sin(yaw), 0;
sin(yaw), cos(yaw), 0;
0, 0, 1];
Ry = [cos(pitch), 0, sin(pitch);
0, 1, 0;
-sin(pitch), 0, cos(pitch)];
Rx = [1, 0, 0;
0, cos(roll), -sin(roll);
0, sin(roll), cos(roll)];
R = Rz Ry Rx;
end
```
Output:
This MATLAB code performs the numerical integration of Euler angle kinematic equations,
computes the pitch angle, and generates a 3D visualization of the spacecraft's orientation over time.
12. Numerical Integration of ODE Functions of Euler ANGLES for YAW and 3D
Visualization of Spacecraft Motion
1. Introduction
This lab focuses on the numerical integration of Euler angles to model the attitude dynamics of a
spacecraft. The objective is to plot the yaw angle over time and visualize the spacecraft’s 3D motion
based on these Euler angles.
2. Objectives
- To understand the use of Euler angles (yaw, pitch, roll) in representing spacecraft orientation.
- To plot the yaw angle over time from the integrated data.
3. Theory
Euler angles describe the orientation of a rigid body in space using three angles: yaw (rotation about
the z-axis), pitch (rotation about the y-axis), and roll (rotation about the x-axis). The dynamic
equations for Euler angles describe how these angles evolve based on the body’s angular velocity
components ( p ), ( q ), and ( r ).
4. Apparatus/Software
- MATLAB
Specify the angular velocities ( p ), ( q ), and ( r ) in the body frame of the spacecraft.
Use MATLAB’s `ode45` solver to integrate the equations of motion for Euler angles over a
specified time span.
Extract and plot the yaw angle \( \psi \) as a function of time from the integrated data.
Use the Euler angles to generate a 3D visualization of the spacecraft’s orientation over time.
6. Observations
Discuss the evolution of the yaw angle and how Euler angles offer a practical way to represent and
visualize the spacecraft’s attitude.
MATLAB Example Code: Numerical Integration of Euler Angles for Yaw and 3D Visualization
```matlab
% Time span
roll = euler(1);
pitch = euler(2);
0, cos(roll), -sin(roll);
0, sin(roll)/cos(pitch), cos(roll)/cos(pitch)];
% Euler angles rates
end
yaw = euler(:,3);
figure;
plot(t, yaw);
title('Yaw vs Time');
xlabel('Time (s)');
ylabel('Yaw (rad)');
figure;
for i = 1:length(t)
roll = euler(i,1);
pitch = euler(i,2);
yaw = euler(i,3);
axis equal;
grid on;
pause(0.1);
hold off;
end
function R = eul2rotm(eul)
Rz = [cos(yaw), -sin(yaw), 0;
sin(yaw), cos(yaw), 0;
0, 0, 1];
Ry = [cos(pitch), 0, sin(pitch);
0, 1, 0;
-sin(pitch), 0, cos(pitch)];
Rx = [1, 0, 0;
0, cos(roll), -sin(roll);
0, sin(roll), cos(roll)];
R = Rz Ry Rx;
End
```
Output:
This MATLAB script numerically integrates the Euler angle kinematic equations, computes the yaw
angle, and generates a 3D visualization of the spacecraft's orientation over time.
13. Numerical Integration of ODE Functions of Euler Parameters for YAW and 3D
Visualization of Spacecraft Motion
1. Introduction
The objective of this lab experiment is to perform numerical integration of the equations of motion
using Euler parameters (quaternions) for spacecraft attitude dynamics, specifically focusing on
plotting the yaw angle over time and visualizing the resulting 3D motion of the spacecraft.
2. Objectives
3. Theory
Euler parameters (quaternions) are a set of four parameters used to describe the orientation of a rigid
body in three-dimensional space. They do not suffer from the singularities associated with Euler
angles and are commonly used in spacecraft attitude control.
4. Apparatus/Software
- MATLAB
5. Procedure
Specify the angular velocities ( p ), ( q ), and ( r) (body axis rates) in the spacecraft's frame.
Initialize the quaternion ( q = [q0, q1, q2, q3] ) representing the spacecraft's initial orientation.
Use MATLAB’s ODE solver (`ode45`) to numerically integrate the quaternion kinematic equations.
Calculate the yaw angle from the quaternion components using the following formula:
Plot the yaw angle as a function of time to visualize how it evolves during the motion.
7. Step 7: Visualize 3D motion
Using the quaternion data, create a 3D visualization of the spacecraft's orientation over time.
6. Observations
7. Conclusion
Summarize the results of the experiment, including insights on the evolution of yaw and how Euler
parameters facilitate the smooth representation of 3D orientation.
MATLAB Example Code: Numerical Integration of Euler Parameters for Yaw and 3D
Visualization
```matlab
% Time span
end
yaw = atan2(2 (q(:,2) . q(:,3) + q(:,1) . q(:,4)), q(:,1).^2 + q(:,2).^2 - q(:,3).^2 - q(:,4).^2);
figure;
plot(t, yaw);
title('Yaw vs Time');
xlabel('Time (s)');
ylabel('Yaw (rad)');
figure;
for i = 1:length(t)
R = quat2rotm(q(i,:));
axis equal;
grid on;
pause(0.1);
hold off;
end
function R = quat2rotm(q)
end
```
Output:
This MATLAB code performs the numerical integration of quaternion kinematic equations, computes
the yaw angle, and provides a 3D visualization of the spacecraft's orientation.
14. Numerical Integration of ODE Functions of Euler Parameters for YAW and 3D
Visualization of Spacecraft Motion
1. Introduction
The objective of this lab is to perform the numerical integration of the equations of motion using
Euler parameters (quaternions) to describe spacecraft attitude dynamics, focusing on plotting the roll
angle over time and visualizing the resulting 3D spacecraft motion.
2. Objectives
3. Theory
Euler parameters, also known as quaternions, are a set of four parameters ( q0, q1, q2, q3 ) that
represent the orientation of a rigid body in three-dimensional space. They are useful for avoiding the
singularities associated with Euler angles and provide an efficient way to represent rotation.
where ( q = [q0, q1, q2, q3] ) is the quaternion vector, and ( Omega ) is the angular velocity matrix
derived from the angular velocity components ( p ), ( q ), and ( r) about the body axes.
4. Apparatus/Software
- MATLAB
5. Procedure
Specify the angular velocities ( p ), ( q ), and ( r ) representing the body axis rates of the spacecraft.
Initialize the quaternion ( q = [q0, q1, q2, q3] ) to represent the initial orientation of the spacecraft.
Create the ODE function in MATLAB to model the quaternion kinematic equations.
4. Step 4: Perform numerical integration
Use MATLAB's `ode45` to integrate the quaternion differential equations over a specified time
span.
From the quaternion solution, calculate the roll angle using the following formula:
Plot the roll angle as a function of time to visualize how it evolves during the spacecraft’s motion.
Using the quaternion data, generate a 3D visualization of the spacecraft’s orientation over time.
6. Observations
7. Conclusion
Summarize the results of the experiment, discussing the evolution of roll and the benefits of using
Euler parameters for attitude representation in space.
```matlab
end
roll = atan2(2 (q(:,3) . q(:,2) + q(:,1) . q(:,4)), q(:,1).^2 + q(:,2).^2 - q(:,3).^2 - q(:,4).^2);
figure;
plot(t, roll);
title('Roll vs Time');
xlabel('Time (s)');
ylabel('Roll (rad)');
% 3D visualization of the spacecraft orientation
figure;
for i = 1:length(t)
R = quat2rotm(q(i,:));
axis equal;
grid on;
pause(0.1);
hold off;
end
function R = quat2rotm(q)
end
```
Output:
This MATLAB script performs the numerical integration of quaternion kinematic equations,
computes the roll angle, and generates a 3D visualization of the spacecraft's orientation over time.
15. Numerical Integration of ODE Functions of Euler Parameters for pitch and 3D
Visualization of Spacecraft Motion
1. Introduction
The aim of this experiment is to understand spacecraft attitude dynamics using Euler parameters
(quaternions) for numerical integration of ODEs. This method avoids singularities associated with
Euler angles, making it suitable for describing the orientation of a spacecraft or rigid body in space.
The experiment includes plotting the pitch angle from the quaternion data and visualizing the 3D
orientation of the spacecraft using MATLAB.
2. Objectives
- To understand the concept of Euler parameters (quaternions) and their role in representing spacecraft
orientation.
- To numerically integrate the quaternion kinematic equations using MATLAB.
3. Theory
Euler parameters (quaternions) are four parameters ( q0, q1, q2, q3 ) that represent orientation without
the singularities of Euler angles. They follow the kinematic differential equation:
Where ( q = [q0, q1, q2, q3] ) is the quaternion, and ( Omega) is the angular velocity matrix derived
from the angular velocity components ( p, q, r ).
4. Apparatus/Software
- MATLAB
5. Procedure
Initialize the quaternion ( q = [q0, q1, q2, q3]) representing the spacecraft's initial orientation.
Write the ODE function based on quaternion differential equations using MATLAB.
Use MATLAB's `ode45` function to solve the quaternion kinematic equations over a time span.
From the quaternion solution, calculate the pitch angle using the equation:
6. Observations
7. Conclusion
Summarize the behavior of the spacecraft's attitude and the advantages of using Euler parameters for
representing orientation in space.
MATLAB Example Code:
```matlab
% Time span
end
figure;
plot(t, pitch);
title('Pitch vs Time');
xlabel('Time (s)');
ylabel('Pitch (rad)');
figure;
for i = 1:length(t)
R = quat2rotm(q(i,:));
axis equal;
grid on;
pause(0.1);
hold off;
end
function R = quat2rotm(q)
q0 = q(1); q1 = q(2); q2 = q(3); q3 = q(4);
end
```
Output:
This MATLAB code numerically integrates the quaternion kinematic equations, computes the pitch
angle, and provides a 3D visualization of the spacecraft's orientation.