How to cut off the initial disturbance automatically?
I just come up with a solution when I am writing question...

I can compare the amplitudes of this period and last steady periods (for my case there is a fixed responding frequency). When the relative error is small enough for 5 or 10 times, it can be considered as a good cutoff point.

below a Matlab script I used, and it worked well for my case.

function [t1,y1,t2,y2]=autocut(f1,t1,y1,t2,y2)
    errlim=10e-2;
    cut1=findcut(f1,t1,y1,errlim);
    cut2=findcut(f1,t2,y2,errlim);
    cutp=min([cut1 cut2]);
    t1=t1(cutp:end);
    t2=t2(cutp:end);
    y1=y1(cutp:end);
    y2=y2(cutp:end);
end


function cutnt=findcut(f1,t,y,errlim)
dt=t(20)-t(19);
T1n=ceil(1/f1/dt)*2;%T1n points in one period, number of periods for A=(max-min)/2
tn=length(t);
nperiod=floor(tn/(T1n));
%% Ast is the amplitude of last 5 periods with steady vibration
tstartn=(nperiod-5-1)*T1n+1;tendn=nperiod*T1n;
Ast=(max(y(tstartn:tendn))-min(y(tstartn:tendn)))*0.5;
%% if the relative error is continuously small for 15 periods,
s=0;%count periods that satisfies the condition, 5 statisfaction periods define the steady
for i1=1:nperiod %
    tstartn=(i1-1)*T1n+1;
    tendn=i1*T1n;
    yamp(i1)=(max(y(tstartn:tendn))-min(y(tstartn:tendn)))*0.5;
    err(i1)=abs((yamp(i1)-Ast)/yamp(i1));%relative error
    if err(i1)&lt;errlim
        s=s+1;
        if s==5
            break
        end
    end
end

cutnt=tendn;