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

Principles of Heat Transfer (Activate Learning with these NEW titles from Engineering!)
8th Edition
ISBN:9781305387102
Author:Kreith, Frank; Manglik, Raj M.
Publisher:Kreith, Frank; Manglik, Raj M.
Chapter1: Basic Modes Of Heat Transfer
Section: Chapter Questions
Problem 1.74P: A manufacturer in the United States wants to sell a refrigeration system to a customer in Germany....
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
Principles of Heat Transfer (Activate Learning wi…
Principles of Heat Transfer (Activate Learning wi…
Mechanical Engineering
ISBN:
9781305387102
Author:
Kreith, Frank; Manglik, Raj M.
Publisher:
Cengage Learning