Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import numpy as np from scipy.integrate import solve _ ivp # Define the EP differential kinematic equations def ep _ deriv ( t , ep

import numpy as np
from scipy.integrate import solve_ivp
# Define the EP differential kinematic equations
def ep_deriv(t, ep, omega):
q0, q1, q2, q3= ep
q_dot = np.zeros(4)
q_dot[0]=-0.5*(q1* omega[0]+ q2* omega[1]+ q3* omega[2])
q_dot[1]=0.5*(q0* omega[0]- q3* omega[1]+ q2* omega[2])
q_dot[2]=0.5*(q3* omega[0]+ q0* omega[1]- q1* omega[2])
q_dot[3]=0.5*(-q2* omega[0]+ q1* omega[1]+ q0* omega[2])
return q_dot
# Define the body angular velocity as a function of time
def angular_velocity(t):
return np.array([np.sin(0.1* t),0.01, np.cos(0.1* t)])
# Initial EP vector
initial_ep = np.array([0.408248,0.,0.408248,0.816497])
# Time span for integration
t_span =(0,42)
# Integrate the EP differential kinematic equations
solution = solve_ivp(
fun=lambda t, ep: ep_deriv(t, ep, angular_velocity(t)),
t_span=t_span,
y0=initial_ep,
method='RK45',
dense_output=True,
)
# Evaluate the solution at t=42 seconds
result_at_42_seconds = solution.sol(42)
# Calculate the norm of the EP vector component at 42 seconds
norm_ep = np.linalg.norm(result_at_42_seconds[1:])
print(f"The norm of the EP vector component at 42 seconds is: {norm_ep}")

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

Students also viewed these Databases questions