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

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter14: Numerical Methods
Section14.3: Refinements To The Bisection Method
Problem 4E
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.
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
Principles of Information Systems (MindTap Course…
Principles of Information Systems (MindTap Course…
Computer Science
ISBN:
9781305971776
Author:
Ralph Stair, George Reynolds
Publisher:
Cengage Learning