[digital signal modulation] binary differential phase shift keying modulation (2DPSK) based on MATLAB [including Matlab source code phase 163]

Posted by chawezul on Sun, 02 Jan 2022 18:34:13 +0100

1, Get code method

Get code method 1:
The complete code has been uploaded to my resources: [digital signal modulation] binary differential phase shift keying modulation (2DPSK) based on MATLAB [including Matlab source code phase 163]

Get code method 2:
By subscribing to the payment column of zijishenguang blog, private bloggers can obtain this code with payment vouchers.

Note: if you subscribe to the paid column of zijishenguang blog, you can get a code for free (valid for three days from the Subscription Date);

2, Introduction

1 Introduction
Modulation: the message signal is placed on a certain parameter of the carrier to form a modulated signal.
Demodulation: the inverse process of modulation to recover the message signal from the modulated signal.

2 purpose of modulation
In wireless communication, matching channel characteristics, increasing the frequency of transmitted signal and reducing the size of antenna; Spectrum shifting, simultaneous transmission of multiple signals in one channel, multiplexing and improving channel utilization; Expand the signal bandwidth and improve the anti-interference ability of the system; Realize the exchange of bandwidth and signal-to-noise ratio (effectiveness and reliability); use the telephone line to connect the PC to the Internet, and it is necessary to translate analog / digital signals.

3 Classification of modulation
3.1 signals involved
Message signal, also known as modulation signal and baseband signal;
Carrier: carrier, commonly used sine wave and pulse sequence;
Modulated signal: modulated carrier, which carries the information of message signal and has various forms.
3.2 it can be classified from different angles
According to the type of modulation signal: analog modulation / digital modulation
According to the spectrum structure of modulated signal: linear modulation / nonlinear modulation
Modulated parameters according to sinusoidal carrier: amplitude modulation / frequency modulation / phase modulation
According to the type of carrier signal: continuous wave modulation / pulse modulation

4 amplitude modulation
4.1 General Model
(1) Theoretical basis: Fourier transform
(2) General model
Amplitude modulation: the message signal controls the amplitude of the sinusoidal carrier.
Methods: the message signal is multiplied by the carrier signal through the multiplier, and then through the band-pass filter (time-domain convolution filter characteristics).
Examples: AM, DSB, SSB, VSB.

4.2 conventional double sideband AM
t domain: waveform of modulated signal, modulation / demodulation method
f domain: spectrum of modulated signal, bandwidth B
The envelope of AM signal is proportional to the law of message signal, so a simple * * envelope detection method (incoherent demodulation) * * demodulation can be used;
The spectrum consists of carrier, upper sideband USB and lower sideband LSB. Bandwidth BAM=2fH;
Amplitude modulation is also called linear modulation;
Application: medium and short wave AM broadcasting.
Disadvantages: low power utilization, up to 50%

4.3 suppression of carrier double sideband DSB
The spectrum is composed of upper sideband USB and lower sideband LSB without carrier component. Bandwidth BDSB=BAM=2fH;
The modulation efficiency can reach 100%.
Coherent demodulation:
Methods: the message signal is multiplied by the coherent carrier signal through the multiplier, and then through the low-pass filter (time-domain convolution filter characteristics).
Requirements: carrier synchronization (coherent carrier and carrier signal are in the same frequency and phase)

4.4 SSB modulation
Only one sideband is transmitted, and the frequency band utilization is high. Bandwidth BSSB=BAM/2=fH; In spectrum crowded communication occasions, such as short wave communication and multi-channel carrier telephone system. Low power consumption characteristics. Used in mobile communication system.
Disadvantages: the equipment is complex, there are technical difficulties, and coherent demodulation is required.

4.5 residual sideband modulation VSB
Characteristics of residual sideband filter: complementary symmetry at carrier frequency; A scheme between single sideband and double sideband.

5 angle modulation
Sinusoidal carrier has three parameters: amplitude, frequency and phase. Can carry message signals.
Both frequency (FM) and phase (PM) are called angle modulation.
Frequency modulation (FM)
When the amplitude is constant, the instantaneous phase is differentiated by t to obtain the instantaneous angular frequency.
The frequency spectrum of FM consists of numerous pairs of side frequencies wc ± nwm on both sides of the carrier frequency component wc, and its amplitude depends on mf;
Theoretically, the bandwidth of FM is infinite;
In practice, the FM bandwidth is calculated by Carson formula: BFM=2(mf+1)fm. FM is the highest frequency of the modulated signal
FM modulation is nonlinear modulation. FM demodulation, also known as frequency discrimination, is realized by differential circuit + envelope detection.
Characteristics and application of FM
Features: constant amplitude and constant envelope.
Advantages: strong anti noise ability;
Cost: occupy large channel bandwidth and low spectrum utilization;
Application: occasions with high quality or high channel noise. Such as satellite communication, mobile communication, microwave communication, etc.

6 anti noise performance
Performance index: output signal-to-noise ratio, system gain
Input SNR: Ni=n0B. n0 is the unilateral power spectral density of noise, B=2fH is the bandwidth, which is twice the baseband bandwidth.

AM DSB SSB VSB (amplitude modulation)
Coherent demodulator: linear demodulation, signal and noise can be processed separately.
The anti noise performance of double sideband and single sideband modulation is the same.
When the signal-to-noise ratio is small, the signal is interfered into noise, resulting in threshold effect. The reason is the nonlinear demodulation of envelope detection.
The signal-to-noise ratio is fixed.
FM (angle modulation)
FM system can improve anti noise performance (signal-to-noise ratio) by increasing transmission bandwidth.

summary
Spectrum utilization SSB > VSB > DSB / am > FM
Anti noise performance: FM > DSB / SSB > VSB > am
Equipment complexity: AM is the simplest, DSB/FM is the second, and SSB is the most complex

3, Partial source code

i=10;
j=5000;
t=linspace(0,5,j);%0-5 5000 point line vectors will be generated between[0,5]Divided into 5000 parts
fc=5;%carrier frequency 
fm=i/5;%chip rate 
B=2*fm;%Signal bandwidth
 
%Generate baseband signal
a=round(rand(1,i));
%figure(4);stem(a);
st1=t;
for n=1:10
    if a(n)<1;
        for m=j/i*(n-1)+1:j/i*n
            st1(m)=0;
        end
    else
        for m=j/i*(n-1)+1:j/i*n
            st1(m)=1;
        end
    end
end
figure(1);
subplot(321);
plot(t,st1);
title('Absolute code');
axis([0,5,-1,2]);
 
%Differential transformation
%Set 0 as reference bit
b=zeros(1,i);%All zero matrix
if(a(1)==0)
    b(1)=0;
else
    b(1)=1;
end
for n=2:10
    if a(n)==b(n-1)
        b(n)=0;
    else
        b(n)=1;
    end
end
st1=t;
for n=1:10
    if b(n)==0
        for m=j/i*(n-1)+1:j/i*n
            st1(m)=0;
        end
    else
        for m=j/i*(n-1)+1:j/i*n
            st1(m)=1;
        end
    end
end
subplot(323);
plot(t,st1);
title('Relative code st1');
axis([0,5,-1,2]);
 
st2=t;
for k=1:j;
    if st1(k)==1;
        st2(k)=0;
    else
        st2(k)=1;
    end
end;
subplot(324);
plot(t,st2);
title('Relative code inverse code st2');
axis([0,5,-1,2]);
 
%carrier signal
s1=sin(2*pi*fc*t);
subplot(325);
plot(s1);
title('carrier signal s1');
s2=sin(2*pi*fc*t+pi);%A phase shift
subplot(326);
plot(s2);
title('carrier signal s2');
 
%signal modulation 
d1=st1.*s1;
d2=st2.*s2;
figure(2);
subplot(411);
plot(t,d1);
title('st1*s1');
subplot(412);
plot(t,d2);
title('st2*s2');
e_dpsk=d1+d2;
subplot(413);
plot(t,e_dpsk);
title('Modulated waveform');
 
%Noise adding
noise=rand(1,j);
dpsk=e_dpsk+noise;%Add noise
subplot(414);
plot(t,dpsk);
title('Signal after noise');
 
%Coherent demodulation
dpsk=dpsk.*s1;%And carrier s1 Multiply
figure(3);
subplot(411);
plot(t,dpsk);
title('And carrier s1 Multiplied waveform');
 
[f,af]=T2F(t,dpsk);%Fourier transform
[t,dpsk]=lpf(f,af,B);%Through low-pass filter,Filter out some noise
subplot(412);
plot(t,dpsk);
title('Low pass filtered waveform');
 
%Sample decision
%A positive value is judged as 1 and a negative value is judged as 0
st=zeros(1,i);%%All zero matrix
for m=0:i-1
    if dpsk(1,m*500+250)<0
        st(m+1)=0;
        for j=m*500+1:(m+1)*500
            dpsk(1,j)=0;
        end
    else
        for j=m*500+1:(m+1)*500
            st(m+1)=1;
            dpsk(1,j)=1;
        end
    end
end
subplot(413);
plot(t,dpsk);
axis([0,5,-1,2]);
title('Waveform after sampling decision')
 
%Code inverse transform 2 DPSK specific
dt=zeros(1,i);%%All zero matrix
dt(1)=st(1);
for n=2:10;
   % if (st(n)-st(n-1))<=0&&(st(n)-st(n-1))>-1;
    if (st(n)~=st(n-1))
        dt(n)=1;
    else
        dt(n)=0;
    end
end
st=t;
for n=1:10
    if dt(n)<1;
        for m=j/i*(n-1)+1:j/i*n
            st(m)=0;
        end
    else
        for m=j/i*(n-1)+1:j/i*n
            st(m)=1;
        end
    end
end
subplot(414);
plot(t,st);
axis([0,5,-1,2]);
title('Waveform after inverse code transformation');
    

4, Operation results



5, matlab version and references

1 matlab version
2014a

2 references
[1] Shen Zaiyang Proficient in MATLAB signal processing [M] Tsinghua University Press, 2015
[2] Gao Baojian, Peng Jinye, Wang Lin, pan Jianshou Signal and system -- Analysis and implementation using MATLAB [M] Tsinghua University Press, 2020
[3] Wang Wenguang, Wei Shaoming, Ren Xin MATLAB implementation of signal processing and system analysis [M] Electronic Industry Press, 2018

Topics: MATLAB