Simulation of ball bouncing the wall

22 Ansichten (letzte 30 Tage)
Sebastian
Sebastian am 21 Dez. 2020
Kommentiert: Rena Berman am 6 Mai 2021
Hello,
I am a beginner in the Matlab and I need some help.
I need to write a Matlab program that calculates the coefficient of restitution (k) for the given heights: h and h' values and value of v1' (the velocity of ball after hitting the wall). The program is also to show a simulation of the movement of the mass m1, which bounces once from the wall (the wall does not need to be shown in the simulation). The data is presented in the picture.
Thank you in advance for your help.
I can only simulate the pendulum motion in the program like this:
function pendulum
% l=20;
% g=9.81;
[t,teta]=ode45(@equation2,[0:0.1:10],[0,3]);
x=20*cos(teta);
y=sqrt(20^2-x.^2);
for i=1:100
plot([0,x(i)],[0,-y(i)],x(i),-y(i),'.r','MarkerSize',90);
axis([-20,20,-50,0])
pause(0.2)
end
function [dteta] = equation2(t,teta)
dteta=[teta(2);-9.81/20*sin(teta(1))];
  3 Kommentare
Rik
Rik am 25 Dez. 2020
Bearbeitet: Rik am 25 Dez. 2020
Unfortunately for Sebastian Sobieszek it is easy to retrieve the question body from Google cache (the two attached images can't be recovered this easily):
Simulation of ball bouncing the wall
Hello,
I am a beginner in the Matlab and I need some help.
I need to write a Matlab program that calculates the coefficient of restitution (k) for the given heights: h and h' values and value of v1' (the velocity of ball after hitting the wall). The program is also to show a simulation of the movement of the mass m1, which bounces once from the wall (the wall does not need to be shown in the simulation). The data is presented in the picture.
Thank you in advance for your help.
I can only simulate the pendulum motion in the program like this:
function pendulum
% l=20;
% g=9.81;
[t,teta]=ode45(@equation2,[0:0.1:10],[0,3]);
x=20*cos(teta);
y=sqrt(20^2-x.^2);
for i=1:100
plot([0,x(i)],[0,-y(i)],x(i),-y(i),'.r','MarkerSize',90);
axis([-20,20,-50,0])
pause(0.2)
end
function [dteta] = equation2(t,teta)
dteta=[teta(2);-9.81/20*sin(teta(1))];
Rena Berman
Rena Berman am 6 Mai 2021
(Answers Dev) Restored edit

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Image Analyst
Image Analyst am 22 Dez. 2020
See my attached bouncing ball demo. Obviously it's not meant to turn in as-is as the answer to your homework problem, but it might give you ideas.

Weitere Antworten (0)

Kategorien

Mehr zu Classical Mechanics finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by