📄 baseband.m
字号:
clear all;
close all;
Ts=1;
N_sample=8;
dt=Ts/N_sample;
N=1000;
t=0:dt:(N*N_sample-1)*dt;
gt1=ones(1,N_sample); %NRZ
gt2=ones(1,N_sample/2); %RZ
gt2=[gt2 zeros(1,N_sample/2)];
mt3=sinc((t-5)/Ts);
gt3=mt3(1:10*N_sample);
d=(sign(randn(1,N))+1)/2;
data=sigexpand(d,N_sample);
st1=conv(data,gt1);
st2=conv(data,gt2);
d=2*d-1;
data=sigexpand(d,N_sample);
st3=conv(data,gt3);
[f,st1f]=T2F(t,[st1(1:length(t))]);
[f,st2f]=T2F(t,[st2(1:length(t))]);
[f,st3f]=T2F(t,[st3(1:length(t))]);
T=length(t);
figure(1);
subplot(321)
plot(t,[st1(1:length(t))]);
grid on;
axis([0 20 -1.5 1.5]);
ylabel('NRZ');
subplot(322);
plot(f,10*log10(abs(st1f).^2/T));
grid on;
axis([-5 5 -40 10]);
grid on;
ylabel('NRZ PSD');
subplot(323)
plot(t,[st2(1:length(t))]);
grid on;
axis([0 20 -1.5 1.5]);
ylabel('RZ');
subplot(324);
plot(f,10*log10(abs(st2f).^2/T));
grid on;
axis([-5 5 -40 10]);
grid on;
ylabel('RZ PSD');
subplot(325)
plot(t,[st3(1:length(t))]);
grid on;
axis([0 20 -1.5 1.5]);
ylabel('RZ');
subplot(326);
plot(f,10*log10(abs(st3f).^2/T));
grid on;
axis([-5 5 -40 10]);
grid on;
ylabel('RZ PSD');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -