Question

Create a Matlab code using ode45 function to solve the following two equations of a pendulum:

m+M)x'' - ml\Theta'' cos\Theta + ml\Theta'' sin\Theta = F

-x'' cos\Theta + l\Theta'' - g sin\Theta = 0

Force = 10N

5kg pendulum

initial angle = 30







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

COS

T CoS

solve for T, , and0

COS

-x''+(l/cos\theta)\theta'' = gtan\theta

-(M+m)x''+(M+m)(l/cos\theta)\theta'' = (M+m)gtan\theta

add the two equations

ーCOS

mqtan M +m)(/cost

le) cost

Matlab Code:

clear;clc;
syms t;
init = [1,pi/6,0,0];% initial conditions
[t,y] = ode45(@f,[0 10],init);

plot(t,y(:,1));
hold on;
plot(t,y(:,2));

function dydx = f(t,y)
M = 10;m = 5;F = 10;l = 1;g = 9.8;
dydx = zeros(4,1);
dydx(1) = y(1);
dydx(2) = y(2);
dydx(3) = ((M+m)*g*tan(t)+F)/((M+m)*(l/cos(t))+m*l*(sin(t)-cos(t)));
dydx(4) = (l*dydx(3) - g*sin(t))/(cos(t));
end

Add a comment
Know the answer?
Add Answer to:
Create a Matlab code using ode45 function to solve the following two equations of a pendulum: m+M)x'' - ml'' cos + ml'' sin = F -x'' cos + l'' - g sin = 0 Force...
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