[digital signal modulation] am + DSB + SSB + ask + FSK + PSK modulation and demodulation based on GUI [matlab phase 058]

1, Introduction to modulation and demodulation

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); It is necessary to translate analog / digital signals to connect PC to Internet by telephone line.

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

2, Partial source code

function varargout = communication(varargin)
% COMMUNICATION MATLAB code for communication.fig
%      COMMUNICATION, by itself, creates a new COMMUNICATION or raises the existing
%      singleton*.
%
%      H = COMMUNICATION returns the handle to a new COMMUNICATION or the handle to
%      the existing singleton*.
%
%      COMMUNICATION('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in COMMUNICATION.M with the given input arguments.
%
%      COMMUNICATION('Property','Value',...) creates a new COMMUNICATION or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before communication_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to communication_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help communication

% Last Modified by GUIDE v2.5 02-Sep-2019 08:36:43

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @communication_OpeningFcn, ...
                   'gui_OutputFcn',  @communication_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before communication is made visible.
function communication_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to communication (see VARARGIN)

% Choose default command line output for communication
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes communication wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = communication_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --------------------------------------------------------------------
function menu_1_Callback(hObject, eventdata, handles)
% hObject    handle to menu_1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function Untitled_2_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

%=========Program code ======== 
clc ;clear all;
hold on;
Fs=960;  %sampling frequency 
N=960;    %Sampling point
n=0:N-1;t=n/Fs;  %time series
A0=10;  %Carrier signal amplitude 
A1=1;   %Modulation signal amplitude 
fc=120;  %Carrier signal frequency 
fm=30;    %Modulation signal frequency
f=n*Fs/N;  %frequency
w0=2*fc*pi; 
w1=2*fm*pi;

Uc=A0*cos(w0*t);     %carrier signal 
C1=fft(Uc);             %Fourier transform the carrier signal 
cxf=abs(C1);           %Fourier transform  
% figure(1); 
hold on;
 
subplot(6,2,2); plot(f(1:N/2),cxf(1:N/2));title('Carrier signal spectrum'); 
% subplot(6,2,2)
% f = fftshift(C1);
% w = linspace(-Fs/2, Fs/2, N);%Frequency coordinates, units Hz
% plot(w,abs(f));
% title('Spectrum of signal');
% xlabel('frequency(Hz)');

 
 
subplot(6,2,3); plot(t,mes); title('Modulation signal');axis([0 0.5 0 2]);  
subplot(6,2,4);  plot(f(1:N/2),zxc(1:N/2)); title('Modulation signal spectrum'); axis([0 50 0 500])


Uam=modulate(mes,fc,Fs,'am');%AM Modulated signal
C3=fft(Uam);              %  yes AM Fourier transform of modulated signal
asd=abs(C3);
% figure(3)
 
subplot(6,2,6);plot(f(1:N/2),asd(1:N/2)),grid; title('AM Modulated signal spectrum'); 
 
 
% figure(4)
 
axis([0 0.5 0 2]);
subplot(6,2,8); plot(f(1:N/2),wqe(1:N/2)),grid; title('AM Demodulated signal spectrum');

k=awgn(Uam,10);  %Increase the noise, and the signal-to-noise ratio is 10
pp=fft(k,960);
zs=abs(pp);
% figure(6)
subplot(6,2,9);plot(t,k);axis([0 0.5 -2 2])
title('Obtained after adding noise AM Signal time domain waveform');%Obtained after increasing the noise AM Signal time domain waveform
subplot(6,2,10);plot(f(1:N/2),zs(1:N/2));
title('Obtained after adding noise AM Signal frequency domain waveform'); %Obtained after increasing the noise AM Signal frequency domain waveform
grid on;

qaz=demod(k,fc,Fs,'am'); %Demodulation after increasing noise
 
subplot(6,2,11); ;title('The time domain waveform of the signal is demodulated after increasing the noise'); %The time domain waveform of the signal is demodulated after increasing the noise
 
edc=abs(wsx);
subplot(6,2,12);
plot(f(1:N/2),edc(1:N/2));
hold off;
title('The frequency domain waveform of the signal is demodulated after increasing the noise');  %The frequency domain waveform of the signal is demodulated after increasing the noise
grid on;
function [ t, st ] = F2T( f, sf )
df = f(2)-f(1);
Fmx = f(end)-f(1)+df;
dt = 1/Fmx;
N = length(sf);
 
sff = fftshift(sf);
st = Fmx * ifft(sff);
end
% --- Executes just before communication is made visible.
function communication_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to communication (see VARARGIN)

% Choose default command line output for communication
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes communication wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = communication_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --------------------------------------------------------------------
function menu_1_Callback(hObject, eventdata, handles)
% hObject    handle to menu_1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function Untitled_2_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

3, Operation results





4, 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

Keywords: MATLAB

Added by conspi on Wed, 22 Sep 2021 09:06:35 +0300