-
大小: 3KB文件類型: .m金幣: 1下載: 0 次發布日期: 2021-06-04
- 語言: Matlab
- 標簽: matlab2dpsk??
資源簡介
里面有本人運行出來的程序,圖,程序語句后面還有注釋!希望可以幫到大家!
代碼片段和文件信息
clear?all;
close?all;
A=1;
fc=2;?????%2Hz
N_sample=8;
N=500;????%碼元數
Ts=1;?????%1?Baud/s
dt=Ts/fc/N_sample;??%波形采樣間隔
t=0:dt:N*Ts-dt;
Lt=length(t);
%產生二進制信源
d=randn(1N)>.5;
%計算相對碼元
d0=0;
for?i=1:length(d)
????if?(i==1)
????????if?(d(i)==d0)
????????????d_2dpsk(i)=0;
????????else
????????????d_2dpsk(i)=1;
????????end
????elseif?(d(i)==d_2dpsk(i-1))
????????d_2dpsk(i)=0;
???????else
????????d_2dpsk(i)=1;
???????end
end
dd=sigexpand(dfc*N_sample);
gt=ones(1fc*N_sample);???%NRZ波形
figure(1)
subplot(321);???%輸入NRZ信號波形(單極性)
d_NRZ=conv(ddgt);
plot(td_NRZ(1:length(t)));
axis([0?10?0?1.2]);
ylabel(‘輸入信號‘);
subplot(322);??%輸入NRZ頻譜
[fd_NRZf]=T2F(td_NRZ(1:length(t)));
plot(f10*log10(abs(d_NRZf).^2/Ts));
axis([-2?2?-50?10]);
ylabel(‘輸入信號功率譜密度(dB/Hz)‘);
dd1=sigexpand(d_2dpskfc*N_sample);
subplot(323);???%差分NRZ信號波形(單極性)
d_NRZ1=conv(dd1gt);
plot(td_NRZ1(1:length(t)));
axis([0?10?0?1.2]);
ylabel(‘差分信號‘);
subplot(324);??%差分NRZ頻譜
[fd_NRZ1f]=T2F(td_NRZ1(1:length(t)));
plot(f10*log10(abs(d_NRZ1f).^2/Ts));
axis([-2?2?-50?10]);
ylabel(‘差分信號功率譜密度(dB/Hz)‘);
%2dpsk
ht=A*cos(2*pi*fc*t);
d_2dpsk1=2*d_NRZ1-1;
s_2dpsk=d_2dpsk1(1:Lt).*ht;
subplot(325);
plot(ts_2dpsk);
axis([0?10?-1.2?1.2]);
ylabel(‘2DPSK‘);
subplot(326);
[fs_2dpskf]=T2F(ts_2dpsk);
plot(f10*log10(abs(s_2dpskf).^2/Ts));
axis([-fc-4?fc+4?-50?10]);
ylabel(‘2DPSK功率譜密度(dB/Hz)‘);
%采用相位比較法
count=1;
for?i=1:length(t)
????if(mod(i8)==1&i~=1)
????????count=
- 上一篇:最優潮流Matlab程序
- 下一篇:思典-粒子群優化Matlab工具箱
評論
共有 條評論