Ok guys I figured it out, I'm just leaving the solution in case someone got the same problem as me:
or t =0.02:0.02:0.06 v0=((0.02)/2)*(b+a); %calculate the velocity using trapezoidal rule between two acceleration values i=i+1; j=j+1; a=A(i); b=A(j); v1=v0+v1; V(k,1)= v1; % k=k+1;