?? bpskshurujitiaozhi.m
字號:
clear all;
close all;
A = 1;
fc = 2; %2Hz
N_sample = 8;
N = 500; %碼元數
Ts = 1; %1Baud/s
dt = Ts/fc/N_sample; %波形采樣間隔
t = 0:dt:N*Ts-dt;
Lt = length(t);
%產生二進制信源
d = sign(randn(1,N));
dd = sigexpand((d + 1)/2,fc*N_sample);
gt = ones(1,fc*N_sample); %NRZ波形
figure(1)
subplot(211); %輸入NRZ信號波形(單極性)
d_NRZ = conv(dd,gt);
plot(t,d_NRZ(1:length(t)));
axis([0 10 0 1.2]);
ylabel('輸入信號');
subplot(212); %輸入NRZ頻譜
[f,d_NRZf] = T2F(t,d_NRZ(1:length(t)));
plot(f,10*log10(abs(d_NRZf).^2/Ts));
axis([-2 2 -50 30]);
ylabel('輸入信號功率譜密度(dB/Hz)');
figure(2)
%2PSK信號
ht = A*cos(2*pi*fc*t);
d_2psk = 2*d_NRZ-1;
s_2psk = d_2psk(1:Lt).*ht;
subplot(211)
plot(t,s_2psk);
axis([0 10 -1.2 1.2]);
ylabel('2psk');
subplot(212)
[f,s_2pskf] = T2F(t,s_2psk);
plot(f,10*log10(abs(s_2pskf).^2/Ts));
axis([-fc-4 fc+4 -50 30]);
ylabel('2psk功率譜密度(dB/Hz)');
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -