Question

FOUR-Matlab Solve the following equation of motion using Matlab ODE45: 4 -m 6(0) 6(0)-0.1 (0) 0.2 0(0)-1 Assume that: m-0.1 k

solve with matlab

0 0
Add a comment Improve this question Transcribed image text
Answer #1

s (2) ma Lcose-mr 2Hence, our deivative vecor ubiil be S(4) 4 The ode function

Here is the odefunction :

media%2F5ee%2F5eeb7374-36ac-4b57-89b4-00

and Script for solving:

media%2F953%2F9537d868-3781-4ec5-b4f9-24

9 8 7 6 5 θθ 4 3 2 0 432 0-1-2-3-4-5 |

Text:

Function :

function dsdt = odefunction(t,s)
m = 0.1;
g = 10;
L = 1;
r = 0.5;
dsdt = zeros(2,1);      % initializing dsdt

dsdt(1) = s(2);         % Setting 1st element
dsdt(2) = (-3/4)*(m*g*L*cos(s(1)) + m*r^2)/(m*L^2);     % 2nd element

Script :

s0 = [pi/6 0.1];        %Initial Conditions [theta(0) theta_dot(0)]
tspan = [0 10];         % time span
[t,s] = ode45(@(t,s) odefunction(t,s),tspan,s0);     % Solving ODE

% t is time vector and s is solution vector
plot(t,s(:,1))            % plot theta vs t
hold on
plot(t,s(:,2))            % plot theta_dot vs t
legend(["\theta","\theta dot"],'Location','Best')
xlabel("Time [sec]")
% recall our assumptions s(1) = theta, s(2) = theta_dot

Add a comment
Know the answer?
Add Answer to:
FOUR-Matlab Solve the following equation of motion using Matlab ODE45: 4 -m 6(0) 6(0)-0.1 (0) 0.2...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT