a use the data obtained from a to determine the time at which the spring will remain 5346309

a.)Use   the   data   obtained   from   (a)   to   determine   the   time   at   which   the   spring   will

remain   within   (+/-)   0.1%   of   its   equilibrium   position   (x=0).  

This is my code and graph as of now. I dont now how to find that value for part a

%clear all variables
clear all
%constants
cm = 10;
km = 2;
%intial conditions
x1(1)=-2;
x2(1)=0;
%stepsize
tmax=10;
tmin=0;
N=500;
h=(tmax-tmin)/N;

T2(1)=0;
% for loop to solve m
for i =1:N
T(i+1)=i*h;
x1(i+1) = x1(i)+ x2(i)*h;
x2(i+1) = x2(i)+(-cm*(x1(i)))-km*(x2(i))*h;
end
C_analytical = exp(-T).*(-2*cos(3*T))-(2/3)*(sin(3*T));

plot(T,x1,'m')
xlabel('Time');
ylabel('Position')
%hold on
%plot(T,C_analytical)

"Get 15% discount on your first 3 orders with us"
Use the following coupon
FIRST15

Order Now