📄 code.m
字号:
N=1000;
fs=8;
x=ceil(rand(1,N)-0.8);
AMI=AMI_Code(x);
HDB3=HDB3_Code(x);
Miller=Miller_Code(x);
y=zeros(1,N*fs);
x_t=zeros(1,N*fs);
y_AMI=zeros(1,N*fs);
y_HDB3=zeros(1,N*fs);
y_Miller=zeros(1,N*fs);
for i=1:N*fs
if(mod(i-1,8)<=5 & mod(i-1,8)>=2)
y(i)=1;
else
y(i)=0;
end
%分别给画图序列赋值
y_AMI(i)=y(i)*AMI(ceil(i/8));
y_HDB3(i)=y(i)*HDB3(ceil(i/8));
y_Miller(i)=Miller(ceil(i/4));
x_t(i)=x(ceil(i/8));
end
figure
subplot(4,1,1)
plot(x_t(1:20*8))
axis([1,20*8,-1.5,1.5]);
title('initial code')
subplot(4,1,2)
plot(y_AMI(1:20*8))
axis([1,20*8,-1.5,1.5]);
title('AMI code')
subplot(4,1,3)
plot(y_HDB3(1:20*8))
axis([1,20*8,-1.5,1.5]);
title('HDB3 code')
subplot(4,1,4)
plot(y_Miller(1:20*8))
axis([1,20*8,-1.5,1.5]);
title('Miller code')
figure
plot_spectrum(x_t,'b');
hold on
plot_spectrum(y_AMI,'r');
plot_spectrum(y_HDB3,'g');
plot_spectrum(y_Miller,'y');
title('Power spectrum of AMI Code')
legend('NRZ','AMI','HDB3','Miller')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -