clear
clc
len = 14; %二元随机函数长度
%randi([0,1],1,len)生成0~1之间整数,长度为len
r = 2*randi([0,1],1,len)-1;
%若a= [1 2 3]; repelem(a,3)=[1 1 1 2 2 2 3 3 3]
x = repelem(r,100);
n = 1:len*100;% n是所有点数
plot(n/100,x) %n/100将n归一化在len的范围内
clear
clc
len = 14; %二元随机函数长度
%randi([0,1],1,len)生成0~1之间整数,长度为len
r = 2*randi([0,1],1,len)-1;
%若a= [1 2 3]; repelem(a,3)=[1 1 1 2 2 2 3 3 3]
x = repelem(r,100);
n = 1:len*100;% n是所有点数
plot(n/100,x) %n/100将n归一化在len的范围内