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
    

 

-0.11
-0.12-
-0.13-
-0.14-
-0.12
-0.14
Î₂
-0.16-0.1
-0.08
-0.06
î₁
•W
• Wo
H
-0.04
-0.15
-0.2.
-0.25
0.05
Q
0 -0.05
^₂
0.05 0.1 0.15 0.2
ÎL
لالها
H
Transcribed Image Text:-0.11 -0.12- -0.13- -0.14- -0.12 -0.14 Î₂ -0.16-0.1 -0.08 -0.06 î₁ •W • Wo H -0.04 -0.15 -0.2. -0.25 0.05 Q 0 -0.05 ^₂ 0.05 0.1 0.15 0.2 ÎL لالها H
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.
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