I want to know how to get plots like in the image in MATLAB. I have the following code. With the angular velocity data, how do I get a figure like show in the image   I = [0.3; 0.2; 0.4]; w_per1 = [0.1; 0.001; 0.001]; w_per2 = [0.001; 0.1; 0.001]; w_per3 = [0.001; 0.001; 0.1]; L = [0;0;0]; t = 0:300; sigma = [0.3; 0.3; 0.3]; % Finidng EP from MRP EP = MRPtoEP(sigma) % Using ode45 to integrate KDE options = odeset('RelTol',1e-10,'AbsTol',1e-10); [t, y] = ode45(@dwdt_KDE_EP, t, [EP; w_per2], options); % Extract the Euler parameters and angular velocities w_p1 = y(:, 5:7)';     function dqwdt = dwdt_KDE_EP(~,EPw)          I = [0.3; 0.2; 0.4];     L = [0;0;0];        EP = EPw(1:4);     w = EPw(5:7);          dqdt = zeros(4,1);     dwdt = zeros(3,1);     dqdt(1) = 0.5*(EP(4)*w(1) - EP(3)*w(2) + EP(2)*w(3));     dqdt(2) = 0.5*(EP(3)*w(1) + EP(4)*w(2) - EP(1)*w(3));     dqdt(3) = 0.5*(-EP(2)*w(1) + EP(1)*w(2) + EP(4)*w(3));     dqdt(4) = -0.5*(EP(1)*w(1) + EP(2)*w(2) + EP(3)*w(3));     dwdt(1) = (-(I(3) - I(2))*w(2)*w(3) + L(1)) / I(1);     dwdt(2) = (-(I(1) - I(3))*w(3)*w(1) + L(2)) / I(2);     dwdt(3) = (-(I(2) - I(1))*w(1)*w(2) + L(3)) / I(3);     % Combine the time derivatives into a single vector     dqwdt = [dqdt; dwdt];      end function [EP] = MRPtoEP(sigma)     EP1 = (2*sigma(1)) / (1 + dot(sigma, sigma));     EP2 = (2*sigma(2)) / (1 + dot(sigma, sigma));     EP3 = (2*sigma(3)) / (1 + dot(sigma, sigma));     EP4 = (1 - dot(sigma, sigma)) / (1 + dot(sigma, sigma));     EP = [EP1; EP2; EP3; EP4]; end

Elements Of Electromagnetics
7th Edition
ISBN:9780190698614
Author:Sadiku, Matthew N. O.
Publisher:Sadiku, Matthew N. O.
ChapterMA: Math Assessment
Section: Chapter Questions
Problem 1.1MA
icon
Related questions
Question

I want to know how to get plots like in the image in MATLAB. I have the following code. With the angular velocity data, how do I get a figure like show in the image

 

I = [0.3; 0.2; 0.4];
w_per1 = [0.1; 0.001; 0.001];
w_per2 = [0.001; 0.1; 0.001];
w_per3 = [0.001; 0.001; 0.1];
L = [0;0;0];
t = 0:300;
sigma = [0.3; 0.3; 0.3];

% Finidng EP from MRP
EP = MRPtoEP(sigma)


% Using ode45 to integrate KDE
options = odeset('RelTol',1e-10,'AbsTol',1e-10);
[t, y] = ode45(@dwdt_KDE_EP, t, [EP; w_per2], options);

% Extract the Euler parameters and angular velocities
w_p1 = y(:, 5:7)';

 

 

function dqwdt = dwdt_KDE_EP(~,EPw)
    
    I = [0.3; 0.2; 0.4];
    L = [0;0;0];
  
    EP = EPw(1:4);
    w = EPw(5:7);
    
    dqdt = zeros(4,1);
    dwdt = zeros(3,1);

    dqdt(1) = 0.5*(EP(4)*w(1) - EP(3)*w(2) + EP(2)*w(3));
    dqdt(2) = 0.5*(EP(3)*w(1) + EP(4)*w(2) - EP(1)*w(3));
    dqdt(3) = 0.5*(-EP(2)*w(1) + EP(1)*w(2) + EP(4)*w(3));
    dqdt(4) = -0.5*(EP(1)*w(1) + EP(2)*w(2) + EP(3)*w(3));

    dwdt(1) = (-(I(3) - I(2))*w(2)*w(3) + L(1)) / I(1);
    dwdt(2) = (-(I(1) - I(3))*w(3)*w(1) + L(2)) / I(2);
    dwdt(3) = (-(I(2) - I(1))*w(1)*w(2) + L(3)) / I(3);


    % Combine the time derivatives into a single vector
    dqwdt = [dqdt; dwdt];
    
end


function [EP] = MRPtoEP(sigma)

    EP1 = (2*sigma(1)) / (1 + dot(sigma, sigma));
    EP2 = (2*sigma(2)) / (1 + dot(sigma, sigma));
    EP3 = (2*sigma(3)) / (1 + dot(sigma, sigma));
    EP4 = (1 - dot(sigma, sigma)) / (1 + dot(sigma, sigma));

    EP = [EP1; EP2; EP3; EP4];

end
    

 

### Description of the Diagrams

The image contains two 3D plots, each depicting vector fields in three-dimensional space. Both plots show elliptical paths, vectors, and axes, which are presumably related to rotational dynamics or another physical system.

#### Left Plot

- **Axes:**
  - The x-axis is labeled as \( \hat{n}_1 \), ranging approximately from -0.12 to -0.04.
  - The y-axis is labeled as \( \hat{n}_2 \), ranging from -0.16 to -0.08.
  - The z-axis is labeled as \( \hat{n}_3 \), ranging from -0.14 to -0.11.
  
- **Elements:**
  - There is a single elliptical trajectory in black.
  - A black vector labeled \( \vec{\omega} \) is tangent to the ellipse path.
  - \( \vec{\omega}_0 \) is marked by an arrowhead along the trajectory.
  - A blue vector labeled \( \vec{H} \), with an arrowhead, is directed outward from the plane of the ellipse. A dotted blue line represents its path or alignment, possibly indicating an angular momentum vector.

#### Right Plot

- **Axes:**
  - The x-axis is labeled as \( \hat{n}_1 \), ranging approximately from 0.05 to 0.2.
  - The y-axis is labeled as \( \hat{n}_2 \), ranging from -0.1 to 0.2.
  - The z-axis is labeled as \( \hat{n}_3 \), ranging from -0.3 to -0.15.

- **Elements:**
  - There are multiple concentric elliptical paths in black.
  - A black vector labeled \( \vec{\omega} \) is tangent to the outer ellipse.
  - The arrowhead represents the vector \( \vec{\omega}_0 \).
  - A blue vector labeled \( \vec{H} \), along with a dotted blue path line, is displayed, similar to the left plot.

### Legend
- **\( \vec{\omega} \):** Represents the angular velocity vector in both plots.
- **\( \vec{\omega}_0 \):** Denotes a specific point or direction along the trajectory.
- **\( \vec{H} \):** Represents another vector, potentially the angular momentum, shown
Transcribed Image Text:### Description of the Diagrams The image contains two 3D plots, each depicting vector fields in three-dimensional space. Both plots show elliptical paths, vectors, and axes, which are presumably related to rotational dynamics or another physical system. #### Left Plot - **Axes:** - The x-axis is labeled as \( \hat{n}_1 \), ranging approximately from -0.12 to -0.04. - The y-axis is labeled as \( \hat{n}_2 \), ranging from -0.16 to -0.08. - The z-axis is labeled as \( \hat{n}_3 \), ranging from -0.14 to -0.11. - **Elements:** - There is a single elliptical trajectory in black. - A black vector labeled \( \vec{\omega} \) is tangent to the ellipse path. - \( \vec{\omega}_0 \) is marked by an arrowhead along the trajectory. - A blue vector labeled \( \vec{H} \), with an arrowhead, is directed outward from the plane of the ellipse. A dotted blue line represents its path or alignment, possibly indicating an angular momentum vector. #### Right Plot - **Axes:** - The x-axis is labeled as \( \hat{n}_1 \), ranging approximately from 0.05 to 0.2. - The y-axis is labeled as \( \hat{n}_2 \), ranging from -0.1 to 0.2. - The z-axis is labeled as \( \hat{n}_3 \), ranging from -0.3 to -0.15. - **Elements:** - There are multiple concentric elliptical paths in black. - A black vector labeled \( \vec{\omega} \) is tangent to the outer ellipse. - The arrowhead represents the vector \( \vec{\omega}_0 \). - A blue vector labeled \( \vec{H} \), along with a dotted blue path line, is displayed, similar to the left plot. ### Legend - **\( \vec{\omega} \):** Represents the angular velocity vector in both plots. - **\( \vec{\omega}_0 \):** Denotes a specific point or direction along the trajectory. - **\( \vec{H} \):** Represents another vector, potentially the angular momentum, shown
Expert Solution
steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Engineering Drawing
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, mechanical-engineering and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Elements Of Electromagnetics
Elements Of Electromagnetics
Mechanical Engineering
ISBN:
9780190698614
Author:
Sadiku, Matthew N. O.
Publisher:
Oxford University Press
Mechanics of Materials (10th Edition)
Mechanics of Materials (10th Edition)
Mechanical Engineering
ISBN:
9780134319650
Author:
Russell C. Hibbeler
Publisher:
PEARSON
Thermodynamics: An Engineering Approach
Thermodynamics: An Engineering Approach
Mechanical Engineering
ISBN:
9781259822674
Author:
Yunus A. Cengel Dr., Michael A. Boles
Publisher:
McGraw-Hill Education
Control Systems Engineering
Control Systems Engineering
Mechanical Engineering
ISBN:
9781118170519
Author:
Norman S. Nise
Publisher:
WILEY
Mechanics of Materials (MindTap Course List)
Mechanics of Materials (MindTap Course List)
Mechanical Engineering
ISBN:
9781337093347
Author:
Barry J. Goodno, James M. Gere
Publisher:
Cengage Learning
Engineering Mechanics: Statics
Engineering Mechanics: Statics
Mechanical Engineering
ISBN:
9781118807330
Author:
James L. Meriam, L. G. Kraige, J. N. Bolton
Publisher:
WILEY