clc,clear,close all;
dw=0.01;
w=-3:dw:3;
fw1=0.5*exp(-j*2*pi*w*0);
fw2=0.707*exp(-j*2*pi*w*1);
fw3=0.5*exp(-j*2*pi*w*2);
fw=fw1+fw2+fw3;
subplot(211);%画幅度谱
plot(w,abs(fw))
xlabel('w');
ylabel('|fw|');
title('fw(f)的幅度谱');
grid on;
subplot(212);%画相位谱
plot(w,angle(fw));
xlabel('w');
ylabel(' \phi(fw)');
title('fw(w)的相位谱');
grid on;
gtext('图1-1信道的幅频响应特性和相频响应特性')
clc,clear,close all;
sample=8;
dt=1/sample;
ts=1;
n=100;
t=0:dt:(n*sample-1)*ts*dt;
an=randi([0 1],1,1000);
gt=[t>=0]-[t>=ts];
bt=0;
for i=1:1000
bt=bt+an(i)*([t>=i*ts]-[t>=(i+1)*ts]);
end
st=0.5*bt+0.707*[zeros(1,sample),bt(1:length(t)-sample)]+0.5*[zeros(1,2*sample),bt(1:length(t)-2*sample)]
subplot(121)
plot(t,bt);
xlabel('t');
ylabel('bt');
title('bt(t)的波形');
axis([20,40,0,1.5]);
grid on;
subplot(122)
plot(t,st);
xlabel('t');
ylabel('st');
title('st(t)的波形');
axis([20,40,0,3]);
grid on;
gtext('图1-2 Ts=1时信号波形')
clc,clear,close all;
sample=8;
dt=1/sample;
ts=8;
n=100;
t=0:dt:(n*sample-1)*ts*dt;
an=randi([0 1],1,1000);
gt=[t>=0]-[t>=ts];
bt=0;
for i=1:1000
bt=bt+an(i)*([t>=i*ts]-[t>=(i+1)*ts]);
end
st=0.5*bt+0.707*[zeros(1,sample),bt(1:length(t)-sample)]+0.5*[zeros(1,2*sample),bt(1:length(t)-2*sample)]
subplot(121)
plot(t,bt);
xlabel('t');
ylabel('bt');
title('bt(t)的波形');
axis([0,150,0,1.5]);
grid on;
subplot(122)
plot(t,st);
xlabel('t');
ylabel('st');
title('st(t)的波形');
axis([0,200,0,3]);
grid on;
gtext('图1-3 Ts=8时信号波形')