?? djxd.m
字號(hào):
%數(shù)字信號(hào)經(jīng)過多徑信道
clear all;close all;
Ts=8;
N_sample = 16; %每個(gè)碼元的抽樣點(diǎn)數(shù)
dt = Ts/N_sample; %抽樣時(shí)間間隔
N = 1000; %碼元數(shù)
t = 0:dt:(N*N_sample-1)*dt;
dLen = length(t);
gt1 = ones(1,N_sample); %NRZ非歸零波形
d = ( sign( randn(1,N) ) +1 )/2;
data = sigexpand(d,N_sample); %對(duì)序列間隔插入N_sample-1個(gè)0
st1 = conv(data,gt1);
[f sf1] = T2F(t,st1(1:dLen));
%3徑信道
m=[0.5 0.707 0.5];
tao =[ 0 1 2];
hf = m(1)*exp(-j*2*pi*f*tao(1)) +m(2)* exp(-j*2*pi*f*tao(2))+...
m(3)* exp(-j*2*pi*f*tao(3));
%信號(hào)經(jīng)過3徑信道
%yt1 = m(1)*st1(1:dLen)+m(2)*[zeros(1,N_sample), st1(1:dLen-N_sample)]+...
% m(3)*[zeros(1,2*N_sample), st1(1:dLen-2*N_sample)];
yt1 = m(1)*st1(1:dLen)+m(2)*[zeros(1,2), st1(1:dLen-2)]+...
m(3)*[zeros(1,4), st1(1:dLen-4)];
[f yf1] = T2F(t,yt1);
figure(1)
subplot(221)
plot(t,st1(1:dLen),'LineWidth',2);
axis([20 150 0 1.2]);title('輸入信號(hào)');
subplot(223)
plot(t,yt1,'LineWidth',2);
axis([20 150 0 2]);title('經(jīng)過信道輸出信號(hào)');xlabel('t');
subplot(222);
plot(f,abs(sf1),'LineWidth',2);
axis([-2 2 0 300]);title('輸入信號(hào)幅度譜');
subplot(224);
plot(f,abs(yf1),'LineWidth',2);
axis([-2 2 0 300]);title('輸出信號(hào)幅度譜');xlabel('f');
figure(2)
subplot(211)
plot(f,abs(hf),'LineWidth',2);
axis([-2 2 0 2]);title('信道幅頻特性');xlabel('f');
subplot(212)
plot(f,angle(hf)/pi);title('信道相頻特性');xlabel('f');
axis([-2 2 -1 1]);
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -