the full detaled question is in the word file attached.
1)Create your own version of Q2R. Look at R2Q (provided on CANVAS) as an example – code should be about the same length.
Your script shall be called “your last name_HW2_4807_Q2R.m” please replace “your last name” with your actual last name.
MATLAB Function Name
Input Format
Output Format
function [a,phi,R,q] = Q2R(q)
Q2R(q)
q is a 4×1 quaternion
[a,phi,R,q]
phi is in radians
a is a unit vector
a)Show that your Q2R code works for the following cases by comparing with the output of the R2Q that uses the output of Q2R as the input.
Case #1:
Case #2:
Case #3:
b)Your script must verify all constraints, such as magnitude, before returning results.
c)Compute by hand and compare with your MATLAB results
d)Produce a picture (by hand or MATLAB) of the two coordinate systems where one is the identity matrix.
2)First, perform the following tasks in this provided code on CANVAS:
“AEE_4807_HW2_2023_Student_Code.m”:
a. Ensure this code calls your Q2R function (same directory)
b. Code “x_dot” function for kinematics only (should be around line 54 in provided code). HINT: See slide entitled “(4) Quaternions – relationship between quaternion derivative and SV angular rate ” in Lecture 04 Attitude Kinematics slides.
Run simulations for the following initial conditions:
Case #1:
Case #2:
Case #3:
Case #4: 3-2-1 Euler Angle Sequence:
Case #5:
For each case, the satellite’s angular velocity is . Simulation time is 10 seconds for every case.
Provide 2 screenshots of the satellite’s attitude at the beginning and end of the 10 second simulation in your PDF results. Each screenshot should look like what is provided below which is the correct answer for Case 5 at 0 and 5 seconds.
BONUS (1 pt):
Assume the b- and i-frames are currently aligned (q = [ 0 0 0 1])
The sun vector in the i-frame is currently: sun_i = [ 1 1 1 ]/sqrt(3) (see green vector in picture below)
The SV solar panel normal vector is -b_3 (see red “solar_panel” vector in picture below)
GOAL: Align the red “solar panel” and “sun_i“ vectors as shown below taking the following steps:
Step 1) Computing the cross product of these 2 vectors to determine the rotation axis
Step 2) Compute the dot product to determine the rotation angle
Step 3) Create the Euler axis and angle
Step 4) Create the quaternion
Step 5) Create the graphic below by setting the initial quaternion computed in
The previous step, and set the rotation rate omega_b = [ 0 0 0] so the SV does not rotate. NOTE: There is no need to add the vectors as shown in the graphic below, but you do have to show the final values of the R, q, a, and Euler angles (as typically shown in the simulation). If you want to add the vectors, place the code below inside the t_ctr loop after “clf”
Place this order or similar order and get an amazing discount. USE Discount code “GET20” for 20% discount