I need help with my MATLAB code. I am using ode45 to solve my differential equation. But, the size of w_ode is 9x645. Size of t is also 1x645. How is that possible? Shouldn't t be 1x101 and w_ode be 9x101? How do I get the size to be 9x101? I need that size because I am subtract that matrix by another matrix of the same size. I_T = 2; J = 1.5; I = [I_T; I_T; J]; w = [-0.1; 0.3; -1.1]; L = [0;0;0]; t = 0:100; % Using ode45 to integrate w dot options = odeset('RelTol',1e-10,'AbsTol',1e-10); result = ode45(@dwdt_Bframe, t, [w; I; L], options); % Extracting information from ode solver t = result.x w_ode = result.y     function dwdt = dwdt_Bframe(t, wIL)     w = wIL(1:3);     I = wIL(4:6);     L = wIL(7:9);     % The w dot equations     dwdt = zeros(9,1);     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);          % Keep the values of I and L constant     dwdt(4:6) = 0;     dwdt(7:9) = 0; end

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Question

I need help with my MATLAB code. I am using ode45 to solve my differential equation. But, the size of w_ode is 9x645. Size of t is also 1x645. How is that possible? Shouldn't t be 1x101 and w_ode be 9x101? How do I get the size to be 9x101? I need that size because I am subtract that matrix by another matrix of the same size.

I_T = 2;
J = 1.5;
I = [I_T; I_T; J];
w = [-0.1; 0.3; -1.1];
L = [0;0;0];

t = 0:100;

% Using ode45 to integrate w dot
options = odeset('RelTol',1e-10,'AbsTol',1e-10);
result = ode45(@dwdt_Bframe, t, [w; I; L], options);

% Extracting information from ode solver
t = result.x
w_ode = result.y

 

 

function dwdt = dwdt_Bframe(t, wIL)

    w = wIL(1:3);
    I = wIL(4:6);
    L = wIL(7:9);

    % The w dot equations
    dwdt = zeros(9,1);
    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);

    
    % Keep the values of I and L constant
    dwdt(4:6) = 0;
    dwdt(7:9) = 0;

end

Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Symmetric positive definite matrix
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education