# Communication principle exercise 5.3

Solution: (1)

a) From Todd, By Fourier transform, And s2(t)=-s1(t), s1(t) represents 0, s2(t) represents 1, and 0 and 1 are almost 1 / 2, so that the binary sequence is Namely Calculated mean And variance   According to the power spectral density formula, b)

① The model simulation diagram is as follows, ② The baseband waveform is obtained by simulation with matlab, and the bilateral power spectral density is as follows. Waveform analysis: take , the gate function with bandwidth of 0.5 is obtained , its amplitude is 1. order , two representations of binary symbols "1" and "0" are obtained, t from 0 to deadline t_ A total of t have been sent so far as stop_ Stop / TB symbols to get the baseband waveform in the figure above. Then observe the bilateral power spectral density waveform Ps(f) and obtain the maximum value at f=0 , f=1/Tb=1 at the first zero point, and so on, f=n/Tb=n at the nth.

```clear,close all
%---------------------------
%system parameter setting
%---------------------------
T_start=-5;%Simulation start time
T_stop=10;%Simulation end time
T=T_stop-T_start;%Simulation duration
T_sample=1/1000;%time interval
f_sample=1/T_sample;%Sampling rate
N_sample=T/T_sample;%point
T_b=1;%Set the bit interval to 1
M=T_stop/T_b;%Number of symbols sent

%---------------------------
%variable t and f
%---------------------------
t=T_start:T_sample:T_stop-T_sample;%from-5 Start with 0.001 10000 points are sampled for the time interval for subsequent use
%Approximate simulation s1(t)
f=(-N_sample/2:N_sample/2-1)*f_sample/N_sample;%Frequency interval=Sampling rate/Sampling points=0.1，with
%0.1 Is the interval, taking 10000 points, that is, the length is 1000,
%Finally, the bilateral power spectral density, about y Axisymmetric,
%so f Final take(-500,500)section

%---------------------------
%The following is the first question
%Generate waveform and Fourier change
%---------------------------
a_1=randsrc(1,M,[[0 1];[0.5 0.5]]);%generate M Random numbers 0, 1 (equal probability of 0 and 1)
s_t_1_1=rectpuls(t,T_b);%s1(t)
%following for Loop to generate baseband signal s(t)
s_t_1=0;
for i=1:M%superposition M second g_T(t-i*Tb),Seek s(t)
s_t_flag_1=rectpuls(t-0.5-i+1,T_b);%Rectangular pulse g_T(t-i*Tb)
if a_1(i)==0
s_t_1=s_t_1+s_t_flag_1;%an Corresponding to 0 s1(t)
else
s_t_1=s_t_1-s_t_flag_1;%an Corresponding to 1 s2(t)
end
end
s_ff_1=abs(fft(s_t_1_1))*T/N_sample;%|S1(f)|，*T/N_sample For amplitude correction
%The next two lines correct the spectrum position
s_f_1(N_sample/2+1:N_sample)=s_ff_1(1:N_sample/2);
s_f_1(1:N_sample/2)=s_ff_1(N_sample/2+1:N_sample);

%----------------------------
%drafting
%----------------------------
figure(1);
subplot(211);%2 Drawing at row 1, column 1
plot(t,s_t_1);%with t Is the horizontal axis, s_t Drawing for vertical axis
title('baseband signal  s(t)wave form');%title
xlabel('t');%x Axis write t
ylabel('s(t)');%y Axis write s(t)
axis([0,10,-1.5,1.5]);%modify xy Axis presentation range for easy observation
subplot(212);%2 Drawing at row 1 and column 2
plot(f,T_b.*abs(s_f_1).*abs(s_f_1));%with f Is the horizontal axis, Ps(f)=Tb|S1(f)|^2 Drawing for vertical axis
title('Bilateral power spectral density Ps(f)wave form');%title
xlabel('f');%x Axis write f
ylabel('Ps(f)');%y Axis write Ps(f)
axis([-5,5,0,1]);%modify xy Axis presentation range for easy observation```

(2)

a) From Todd, By Fourier transform, Then s2(t)=0, s1(t) represents 0, s2(t) represents 1, and 0 and 1 are almost 1 / 2, so that the binary sequence is Namely Calculated mean And variance   According to the power spectral density formula,  b)

① The model simulation diagram is as follows, ② The baseband waveform is obtained by simulation with matlab, and the bilateral power spectral density is as follows. Waveform analysis: take , the bandwidth is Gate function of , its amplitude is 1. order , two representations of binary symbols "1" and "0" are obtained, t from 0 to deadline t_ A total of t have been sent so far as stop_ Stop / TB symbols to get the baseband waveform in the figure above. Then observe the bilateral power spectral density waveform Ps(f), which is composed of impulse function and Sa function. Because they will be mixed together after superposition, it is not conducive to observation, so they are drawn separately. Both Sa function and impulse function obtain the maximum value at f=0, and Sa function has the maximum value , f at the first zero point_ SA = 2 / TB = 1, and so on. f=2n/Tb=n at n. Maximum value of impulse function , if and only if Where m is an integer with impulse, and | m | is an even number other than 0, the Sa function value is 0, and the impulse is also 0.

③ matlab code

```%---------------------------
%The following is the second question, followed by the code
%Generate waveform and Fourier change
%---------------------------
a_2=randsrc(1,M,[[0 1];[0.5 0.5]]);%generate M Random numbers 0, 1 (equal probability of 0 and 1)
s_t_2_1=rectpuls(t,T_b/2);%s1(t)
%following for Loop to generate baseband signal s(t)
s_t_2=0;
for i=1:M%superposition M second g_T(t-i*Tb),Seek s(t)
s_t_flag_2=rectpuls(t-0.25-i+1,T_b/2);%Rectangular pulse g_T(t-i*Tb)
if a_2(i)==0
s_t_2=s_t_2+s_t_flag_2;%an Corresponding to 0 s1(t)
else
s_t_2=s_t_2;%an Corresponding to 1 s2(t)
end
end
s_ff_2=abs(fft(s_t_2_1))*T/N_sample;%|S1(f)|，*T/N_sample For amplitude correction
%The next two lines correct the spectrum position
s_f_2(N_sample/2+1:N_sample)=s_ff_2(1:N_sample/2);
s_f_2(1:N_sample/2)=s_ff_2(N_sample/2+1:N_sample);
%Impulse response part
delta=0;
for j=-M:M
delta=delta+(sinc(j/2)).*(sinc(j/2)).*sign(dirac(f-j));%sign:f=j/T_b Generate impulse function at
end
P_s_1=0.25.*abs(s_f_2).*abs(s_f_2);
P_s_2=(1/16).*delta;

figure(2);
subplot(211);
plot(t,s_t_2);
title('baseband signal  s(t)wave form');
xlabel('t');
ylabel('s(t)');
axis([0,10,-0.5,1.5]);
subplot(212);
plot(f,P_s_1);
hold on;
plot(f,P_s_2);
title('Bilateral power spectral density Ps(f)wave form');
xlabel('f');
ylabel('Ps(f)');
axis([-10,10,0,1/16]);```

Tags: MATLAB

Posted on Mon, 01 Nov 2021 21:48:10 -0400 by jmartinez