The numerical solution cod for dynamics of Vibro-Impact system with impact condition

1 view (last 30 days)
I am trying to solve the system of differential equations that describes the dynamics of Vibro-Impact system (with impact condition). Namely, dy/dt = x; dx/dt = (A cos(2*pi*F*t))/M; dz/dt = v; dv/dt = 0. Impact occurs at y-z>d+2*w-2*r and impact law, described by the velocities before v(+) and after v(-) an impact, is: v(+) = -m*v(-) +(m+1)*x.
Where y - absolute displacement of the outer structure; x - absolute velocity of the outer structure; z - absolute displacement of the ball; v - absolute velocity of the ball.
A, F, M, d, w, r, m are parameters.
Following Euler's scheme I tried to writ matlab cod, please help me frame the impact condition:
%Code to solve Dynamics of Impact Pair
clear; clc
%Parameters
A=0.01; %N
F=2; %Hz
M=124.5; %g
d=42;%mm
w=6;%mm
r=5;%mm
m=1;
%Inputs
h=0.001;
t_final=55;
N=t_final/h;
%Initial condition
t(1)=50;
y(1)=-A/(M*(2*pi*F)^2); %abs. displacement of the outer structure M
x(1)=0; %abs. velocity of the outer structure M
z(1)=0; %abs. displacement of the ball m
v(1)=0; %abs. velocity of the ball m
%update loop
for i=1:N
t(i+1)=t(i)+h;
y(i+1)=y(i)+h*(x(i));
x(i+1)=x(i)+h*(A*cos(2*pi*F*t(i))/M);
z(i+1)=z(i)+h*(v(i));
v(i+1)=v(i);
if abs(y(i+1)-z(i+1))>(d+2*w-2*r)/2,
v(i+1)=-m*v(i)+(m+1)*x(i+1);
switch k (i)= t(i+1)
k(i+1)=k(i)+h
end
end
figure(1); clf(1)
plot(t,z)
xlabel ('Time (s)')
ylabel ('abs. displacement M')
if somebody knows how to use ODE23 with impact handled by the EVENT FUNCTION feature in this case the suggestions are also welcome. Thank you.

Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!