Professional Documents
Culture Documents
SM - Curs - 2
SM - Curs - 2
Olivia Florea
Kinematics of particle
dv dv
a = −kv 2 ⇔ = −kv 2 ⇔ 2 = −kdt ⇔
dt v
−1
Z
dv 1
= −kdt ⇔ = −kt + C ⇔ = kt + C
v2 v v
1
For t = 0 we have v(0) = v0 ⇔ v0 =C
1 1 v0
= kt + ⇒v=
v v0 ktv0 + 1
But,
dx dx v0 v0
v= ⇔ = ⇔ dx = dt
dt dt ktv0 + 1 ktv0 + 1
Zx Zt
v0 1
dx = dt ⇒ x = ln(ktv0 + 1) ⇔ xk − ln(ktv0 + 1) = 0
ktv0 + 1 k
0 0
Name the M-file kinematics.m. At the command prompt call the file
kinematics. We can observe that the value of constant k is 0.35.
ẍ = 0 ⇒ ẋ = C1 ⇒ x = C1 t + C2
mẍ = 0
⇒ 2
mÿ = −mg ÿ = −g ⇒ ẏ = −gt + C3 ⇒ y = − gt2 + C3 t + C4
y(0) = 0 ⇒ C4 = 0
2
ẏ(0) = uy = u sin θ ⇒ C3 = u sin θ ⇒ y(t) = − gt2 + ut sin θ
But, we know: x = 5000m, y = 1500m, u = 400m/s:
Solving these two equations in Matlab using the Maple symbolic computation:
>> eqn1=’5000=400*cos(x)*y’
eqn1 =
5000=400*cos(x)*y
>> eqn2=’1500=400*sin(x)*y-1/2*9.81*y^2’
eqn2 =
1500=400*sin(x)*y-1/2*9.81*y^2
1.4065576854329889257535399604352
0.45569543583977478547338635263748
-2.685897217750018452989257030642
-1.7350349681568043127091034228443
y =
76.452007728583426926316546391465
13.920516408172829238156414017816
-13.920516408172829238156414017816
-76.452007728583426926316546391465
t1=0:0.01:13.92;
t2=0:0.01:76.45;
x1=400*cos(0.455695)*t1;
y1=400*sin(0.455695)*t1-1/2*9.81*t1.^2;
x2=400*cos(1.4066)*t2;
y2=400*sin(1.4066)*t2-1/2*9.81*t2.^2;
plot(x1/1000,y1/1000,x2/1000,y2/1000)
xlabel(’x[km]’)
ylabel(’y[km]’)
title(’projectile trajectory’)
1.3 Frenet Coordinates
A baseball player releases a ball with initial conditions shown in the figure.
Plot the radius of curvature of the path just after release and at the apex
as a function of the release angle θ.
ẏ(1) = y(2)
t=[0 4];
y0=[0.02;0];
[t,y]=ode45(’unforced1’,t,y0);
plot(t,y(:,1),’r’,t,y(:,2),’g’);
legend(’displacement’,’velocity’)
grid on
xlabel(’time’)
ylabel(’x[m],v[m/s]’)
title(’Displacement and Velocity Vs Time’)
hold on;
We want to represent the plot for different values of ξ = [0, 0.1, 0.25, 0.5, 0.75, 1].
The M-file is:
tspan=[0 4];
y0=[0.02;0];
xi=[0,0.1,0.25,0.5,0.75,1];
color=[’r’,’b’,’g’,’m’,’y’,’k’];
for i=1:6
unforced2 = @(t,y)[y(2);(-(2*xi(i)*10*y(2))-(100*y(1)))];
[t,y]=ode45(unforced2,tspan,y0);
plot(t,y(:,1),color(i))
grid on
xlabel(’time’)
ylabel(’Displacement’)
title(’Displacement Vs Time’)
hold on;
end
legend(’xi=0’,’xi=0.1’,’xi=0.25’,’xi=0.5’,’xi=0.75’,’xi=1’);
Course 2- SM- Master IVPA – Conf. Dr. Olivia Florea
θ = y(1)
θ̇ = y(2)
When the values of theta and the first derivative of theta are substituted
in the second order linearized differential equation, we get the following
two first order differential equation:
ẏ(1) = y(2)
g
ẏ(2) = − y(1)
l
For a nonlinear system, sin θ 6= θ The second order non-linear differential
equation reduces to the following, two first order differential equation:
ẏ(1) = y(2)
g
ẏ(2) = − sin y(1)
l
MATLAB Code The MATLAB code is written following the procedure
adopted to solve the spring-massdamper system. For the linear case the
function file is saved as linear.m.
function yp = linear(t,y)
yp = [y(2);((-g/l) *(y(1)))];
In this example, the value of l is chosen to be 5 cms. So the value of g/l
turns out to be 196.2 per square second. Note that since the mass and
the length are expressed in grams and centimeters respectively, the value
of the acceleration due to gravity g is taken to be 981 cms per square
second. Substitute this value in the above MATLAB code.
For the nonlinear case, open a new M-file to write a separate function
file for the nonlinear differential equation. In this case the function file is
saved as nonlinear.m.
function yp = nonlinear(t,y)
yp = [y(2);((-g/l) *sin(y(1)))];
The main code should be written in a separate M-file, which will actually
call the above function files, solve the derivatives stored in them and plot
the required result.
tspan = [0 5];
y0 = [1.57;0];
[t,y] = ode45(’linear’,tspan,y0)
plot(t,y(:,1))
grid on;
xlabel(Time)
ylabel(Theta)
title(Theta Vs Time)
hold on;
tspan represents the time interval and y0 represents the initial condition.
Note that the value of in the initial conditions must be expressed in
radians. Now run the code for the linearized version of the simple pendulum.
A plot of theta versus time will be obtained. The hold command in
the code freezes the plot obtained. This command is used so that the
nonlinear version can also be plotted in the same graph. After running
the program for the linear version, change the name of the function in the
third line of the main code from linear to nonlinear. By doing this, the
Ode45 command will now solve the nonlinear differential equations and
plot the result in the same graph. To differentiate between the linear and
the non-linear curve, use a different line style. The plots of the responses
are attached. From the plots we can see that the time period for the
non linear equation is greater than that of the linear equation. To plot
the angular velocity with respect to time change the variable in the plot
command line in the main code from y(:,1) to y(:,2). This is done because
initially we assigned y(1) to theta and y(2) to the first derivative of theta.
− − −