f = 500; Ts = 1/f; %设置采样周期 n = 12; %设置数据个数 Mag = 0.1; %设置幅值 p = 2^n-1; ms = Mag * idinput(p,'prbs'); t = 0:Ts:Ts*(p-1); %M =[t',ms]; %生成M序列 t2 = 0:Ts:Ts*(20*p-1); ms2 = [ms;ms;ms;ms;ms;ms;ms;ms;ms;ms;ms;ms;ms;ms;ms;ms;ms;ms;ms;ms]; M =[t2',ms2]; %生成M序列 % figure (1) % plot(t',ms) % ylim([-1.5*Mag,1.5*Mag]) % simulatetime = Ts*(p-1); sampletime = Ts;