A ball of mass m=0.12 kg is a t rest at the origin of the X axis.
At the moment t0=0 a force parallel to the X axis begins to act upon the ball.
The force varies in time by the expression:
F(t)=6*sin(4*pi*t-pi/6)-0.5.
Numerically aproximate the law of motion x(t) of the ball and plot it for the time interval t=[0,10].
m=0.12 initial_time=0;final_time=10;N=1001;t=linspace(initial_time,final_time,N);dt=t(2)-t(1);x(1)=0;x(2)=0;for i=2:N-1 x(i+1)=2*x(i)-x(i-1)+dt*dt*(6*sin(4*pi*t(i)-pi/6)-0.5);end;plot(t,x);
m=0.12 ;initial_time=0;final_time=10;N=1001;t=linspace(initial_time,final_time,N);dt=t(2)-t(1);
The ball at t0 is at position 0 on the X axis, so x0=0
there is no initial speed so x1=x0=0
x(1)=0;x(2)=0;for i=2:N-1 x(i+1)=2*x(i)-x(i-1)+dt*dt*(6*sin(4*pi*t(i)-pi/6)-0.5)/m;endplot(t,x);
I do not think I got the correct solution to this problem, it seems a little bit weird that the ball is only moving in one direction, shouldn't it oscilate araound an center point given that the function is dependant of sin?
Best Answer