You are on page 1of 13

# School for Electronic and Computer Engineering

Faculty of

Engineering

## School of Electrical, Electronic &

Computer Engineering
EERI 321
PRACTICAL 1

Completed by:
Mnr Carel Minnaar 22738983
Mnr Lemuel Zwart 22689125

Submitted to:

Dr. K Uren
29 AUGUST 2014

## School of Electrical, Electronic and Computer Engineering

LIST OF FIGURES..........................................................................................III
LIST OF ABBREVIATIONS AND SYMBOLS.........................................................III
1.

PROBLEM STATEMENT..............................................................................1

2.

2.1.

2.2.

2.3.

## SCENARIO 3: BALL AND FLOOR............................................................................3

2.4.

EQUATIONS

OF

MOTION.............................................................................................4

3.

SIMULATION RESULTS..............................................................................5

4.

CONCLUSION...........................................................................................6

5.

MATLAB CODE.........................................................................................7

6.

REFERENCES..........................................................................................10

LIST OF FIGURES
Figure 1: Movement scenario of the model............................................................................1
2

g

Force

Damping constant

Spring constant

y / x

Acceleration

y / x

Velocity

y/x

Position

## School of Electrical, Electronic and Computer Engineering

1.PROBLEM STATEMENT
A soccer ball is considered as a physical system and must be modelled to determine how it
reacts in a certain environment. Factors, parameters and laws that will affect the soccer ball
will then be obtained for this certain environment. Differential equations will then also be
obtained and the model of the soccer ball will then be programmed and simulated in
MATLAB.

## 2.MODEL OF SOCCER BALL

The mass of the soccer ball (M) equals 0.3 kg from the specifications. The damping and
spring constants can be chosen as any realistic values.
Figure 1 shows the movement model of the soccer ball in an environment (room) that must
be used to derive differential equations and to be simulated in MATLAB.
The simulation program will then be used to determine the point where the soccer ball
collides with the wall

( x1 , y1 )

and that the soccer balls first bounce must be directly under

## School of Electrical, Electronic and Computer Engineering

There are three scenarios that must be considered for this model and they are the following:

## The ball bouncing on the floor.

For each scenario, the differential equations will be obtained to help simulate the model of
the soccer ball.

2.1.

## SCENARIO 1: BALL IN AIR

At starting position,

( x0 , y0 )

the only factors that affect the soccer ball are the gravitation

on the ball.
Thus the differential equation for the soccer ball in the air at starting position is as follow:

Fball=Fg
M y =Mg
y =g
(1)
During freefall, the only forces acting on the ball is the 2 nd derivative of the position which in
this scenario is only gravity.

2.2.

( x1 , y1 )

## , the soccer ball collides with the wall and bounces

away from the wall. The soccer ball has elasticity that is basically a spring with a constant of
k. The wall behaves as a damper with a damping constant b, that receives energy from the
ball. The wall dissipates the energy back to the wall and the soccer ball bounces away, but
some of the energy is lost because of damping.[5]

## School of Electrical, Electronic and Computer Engineering

Thus the differential equation for the soccer ball colliding with the wall is as follow:

Fbal l x =( Fb+ Fs )
M x =b x kx
x =

b
k
x x
M
M

(2)
The second derivative of the position in this case translates to horizontal acceleration, and is
caused only by the spring constant. The damping of the wall absorbs and dissipates energy
at each point of contact.

2.3.

## SCENARIO 3: BALL AND FLOOR

The differential equation of the ball making contact with the floor is as follow:

Fball=Fg( Fb+ Fs )
M y =Mgb y ky
y =g

b
k
y y
M
M

(3)
The 2nd derivative of vertical position results in the vertical acceleration which is caused by
gravity and during the time of contact with the floor, the existing direction of force is stored
and then reversed.

Fb

Fs

Fb =b v 21
Where

(4)

( 2v 1 )

F s =k
Where

( v2 v 1 )

(5)

## represent the difference in speed caused by the compression of the

spring.

2.4.

EQUATIONS OF MOTION

The equation of motion used to determine the next inscription in the matrix recording the
velocity for x and y as the for loop is running:

v =u+at

(6)

Where v is the new speed, u is the initial speed and at is the speed increase. [3]
The equation above is required to determine the next position, which is calculated by using
two different formulas.
For calculating the next x-position, consider the fact that gravity has no effect.

s 1=s0 + v i t

(7)

For calculating the next y-position, consider the fact that gravity has an effect. [2]

1
s 1=s0 + v i t + a t 2
2

(8)

by the speed and

vi t

## is the shift in position caused

1 2
a t is the shift in position caused by the acceleration.
2

## School of Electrical, Electronic and Computer Engineering

3.SIMULATION RESULTS
Figure 2 shown below is the plot of the motion of the ball as it bounces until standstill. Decay
in speed is seen in the model as the speed of the displacement changes both horizontally
and vertically. A small incline angle is made with the vertical wall to the right in order to
transfer the maximum energy downwards so the spring can push the ball back upwards in
order to obtain the final position as shown.

## Figure 2: Simulation results of soccer ball movement

For the simulation results the following was used for the parameters:
k =850 N /m

b wall =8 N /s

b floor =2.8 N / s

h=2.5 m

g=9.080665 m. s

## School of Electrical, Electronic and Computer Engineering

4.CONCLUSION
By running the simulation and choosing different parameters, it can be clearly seen that the
parameter with the greatest effect is the initial horizontal speed. This will determine the angle
of the path that the ball makes with the horizontal, in this case the wall to the right. The angle
will affect the vertical downward speed and the vertical downward speed will affect the
maximum upward height the ball will reach after the first bounce. It will also affect the
distance the ball will bounce to the right.
Increasing the speed to a value too high will result in a lower compression of the spring,
which is modelled as the elasticity of the ball, and cause the ball to not be able to reach the
height just under the person throwing it. It was also found that in order for a realistic
simulation, the wall needs to absorb much more energy than the floor and therefore needs a
higher damping coefficient. Also observed was that dampers dissipate (wastes) energy and
springs only reverse the direction of the force by storing it and reproducing it in the opposite
direction.
In order to solve the model so that the ball will bounce back up to height just below the
person throwing it, the initial velocity needed is
required with the wall will be

(4 h , 0.97)

5.9 m/ s

## x -direction is not affected by gravity, only

damping against the wall has an effect on this velocity. It is just as important to note that in a
real world scenario, the friction due to air resistance needs to be taken into account,
especially for higher speeds as the horizontal frictional force experienced is directly
proportional to the square of the velocity. In order to account for this loss, the physical
dimension of the ball needs to be taken into account too, but for this simulation, since the
point of contact is very close to the wall, these losses are considered to be minimal.

## School of Electrical, Electronic and Computer Engineering

5.MATLAB CODE
The code below will specify the parameters used throughout the simulation. All equations
used in the code is written in terms of these variables.
The program starts by defining the mass of the ball, the gravitational acceleration and the
damping constants. Then a matrix counter is used to keep track of the entries in the position,
velocity and acceleration matrix. The time duration simulated is 8 seconds, and each delta
increment is done with a step size of 0.0001 to obtain more accurate results and a smooth
graph.
close all;
clear all;
clc;
ball_mass = 0.3;
%
k = 850;
%
[1]
walldamper = 8;
%
floordamper = 2.8; %
g = -9.80665;
%
h = 2.5;
%
pos_y(1)= h + 2;
%
pos_x(1)= h*2;
%
velocity_y(1)= 0; %
velocity_x(1)= 5.9;%
matrixpos = 1;
y_collide = 0;
%
t = 8;
i = 0.0001;

## Mass of a Scoccer Ball

Spring Constant of ball e = sqrt(height2/height1)
Damping Constant of a wall
Damping Constant of the floor
Acceleration of Gravity
Choose h for a width of 4*2.5
Starting position for y
Starting position for x
Starting velocity for y
Starting velocity for x
True/False Variable for first collision detection

## % Time for simulation to run

% Time steps

The code below will start the simulation and increment each time y 0.001. In order to run the
simulation for a period of 8 seconds, the iteration will repeat for

8
=80 000
0.001

runs.

During freefall, Case 1, only gravitational acceleration causes a force on the ball and thus
the horizontal acceleration is not affected in any way.
for demonstrasie = 0:i:t
% Case1: Ball is in freefall
acceleration_y = g;
acceleration_x = 0;

## School of Electrical, Electronic and Computer Engineering

During contact with the wall, the if statement will determine whether contact is made with the
wall to the left or the wall to the right. This will cause the ball to reverse direction and lose a
little bit of its energy. The second if statement records the position of contact made with the
wall, and will then disable itself in order to prevent further recordings. The equations used
are described under Section 2.

## % Case2: Ball hits the wall

if( (pos_x(matrixpos) <= 0) || (pos_x(matrixpos) >= 4*h) )
acceleration_x = -((walldamper/ball_mass)*velocity_x(matrixpos))
- ((k/ball_mass)*pos_x(matrixpos));
end;
% Do this until 1st collision;
if ( (pos_x(matrixpos )>= 4*h)
y_collide = 1;
y_pov = pos_y(matrixpos);
end;

Still Case2
&& (y_collide == 0) )
% Prevent detection of other impacts
% Point Of Impact with wall

During a Case 3 scenario, the ball will hit the floor and damping will occur. Also, the direction
of the fall is reversed by the equation so the final velocity after compression of the spring.

## % Case3: Ball hits the floor

if(pos_y(matrixpos) <= 0)
acceleration_y = g (floordamper/ball_mass*velocity_y(matrixpos)) (k/ball_mass)*pos_y(matrixpos);
end;

## School of Electrical, Electronic and Computer Engineering

After all damping and frictional losses have been accounted for, the new position, velocity
and acceleration is obtained by using Eulers method. These are piecewise functions that
are calculated linearly, but in very small sections in order to obtain an Analog and realistic
result. The full explanation of the equations used can be found under Section 2.

## % Equation of motion for x;

v = u + at
velocity_x(matrixpos + 1) = velocity_x(matrixpos) + acceleration_x*i;
% Euler for x;
s1 = s0 + vi*t
pos_x(matrixpos + 1) = pos_x(matrixpos) + velocity_x(matrixpos+1)*i;
% Equation of motion for y;
v = u + at
velocity_y(matrixpos + 1) = velocity_y(matrixpos) + acceleration_y*i;
% Euler for y;
s1 = s0 + vi*t + (1/2)*a*(t)^2
pos_y(matrixpos + 1) = velocity_y(matrixpos + 1)*i + pos_y(matrixpos) +
(1/2)*acceleration_y*(i)^2;
matrixpos = matrixpos + 1; % Next Matrix Position
end;

Finally, the matrix is plotted and the result is printed to the main window.

grid on;

## fprintf('For the parameters given, x_impact is : %u\n',4*h);

fprintf('For the parameters given, y_impact is : %u\n',y_pov);
title ('Displacement (m)','fontsize',14);
ylabel('Height(m)','fontsize',10);
xlabel('Length(m)','fontsize',10);

## School of Electrical, Electronic and Computer Engineering

6.REFERENCES
[1] Physics.hku.hk, The Science of Soccer, 1 ed. ,
http://www.physics.hku.hk/~phys0607/lectures/chap05.html: physics.hku.hk, 2014-08-27.
[2] R.C. Hibbeler, Dynamics, 13 ed. , Singapore: pearson, 2013.
[3] Glenn Elert, " Equations of Motion," The Physics Hypertextbook, 1 ed., Ed. Glenn Elert,
http://physics.info/motion-equations/: Physics.info, 2014, .
[4] David Baez-Lopez, MATLAB with Applications to Engineering, 1 ed. , NYC: CRC Press,
12 Aug 2014.
[5] Richard C.Dorf, Modern control Systems, Twelfth ed. , University of California, Davis:
Pearson, 2011.

10