Question

USE MATLAB ALSO PLOT THE PENDULUM animation

Case 1: Pendulum

Create a plot that shows a pendulum moving.

First,use the ode45 function to solve the pendulum equation between 0 and 10 seconds. The pendulum equation is:

Create a plot that shows a pendulum moving First, use the ode45 function to solve the pendulum equation between 0 and 10 seco

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

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

clc
clear all
g=9.82;
L=2;
f=@(t,y) [y(2);-(g*sin(y(1)))/L];
y0=[pi/3,0];
[T,TH]=ode45(f,[0,10],y0);
th=TH(:,1);
x=3-2*sin(th);
y=3-2*cos(th);
h = animatedline;
for i=1:length(x)
addpoints(h,x(i),y(i));
drawnow
end

Figure 1 Eile Edit yiew Insert lools Desktop ndow Help 1.9 1.8 1.6 1.5 1.3 1.5 2.5 3.5 4.5 O Type here to search ^늄洞41) ENG 2

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
USE MATLAB ALSO PLOT THE PENDULUM animation Case 1: Pendulum Create a plot that shows a...
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