【数字信号调制】基于matlab GUI AM+FM+DSB+SSB调制解调【含Matlab源码 1212期】

499 阅读9分钟

一、简介

1 绪论 调制:把消息信号寄托到载波的某个参数上,形成已调信号。 解调:调制的逆过程,从已调信号中恢复消息信号。

2 调制的目的 无线通信中,匹配信道特性,提高发射信号的频率,减小天线尺寸;频谱搬移,一条信道中同时传输多路信号,多路复用,提高信道利用率;扩展信号带宽,提高系统抗干扰能力;实现带宽与信噪比的互换(有效性和可靠性);利用电话线将PC机接入Internet,需要翻译模/数信号。

3 调制的分类 3.1 涉及的信号 消息信号,又称调制信号、基带信号; 载波:运载工具,常用的是正弦波、脉冲序列; 已调信号:受调载波,载有消息信号的信息,具有多种形式。 3.2 可以从不同角度分类 按调制信号的类型:模拟调制/数字调制 按已调信号的频谱结构:线性调制/非线性调制 按正弦载波的受调参量:幅度调制/频率调制/相位调制 按载波信号的类型:连续波调制/脉冲调制

4 幅度调制 4.1 一般模型 (1)理论基础:傅里叶变换 (2)一般模型 幅度调制:消息信号控制正弦载波的幅度。 方法:用消息信号通过相乘器乘上载波信号,再通过带通滤波器(时域卷积滤波器特性)。 举例:AM、DSB、SSB、VSB。

4.2 常规双边带调幅AM t 域:已调信号的波形,调制/解调方法 f 域:已调信号的频谱,带宽B AM信号的包络正比于消息信号的规律,因此可以采用简单的**包络检波方法(非相干解调)**解调; 频谱由载波、上边带USB、下边带LSB组成。带宽BAM=2fH; 幅度调制又称为线性调制; 应用:中短波调幅广播。 缺点:功率利用率低,最多达到50%

4.3 抑制载波双边带DSB 频谱由上边带USB、下边带LSB组成,没有了载波分量。带宽BDSB=BAM=2fH; 调制效率可达100%。 采用相干解调: 方法:用消息信号通过想乘器乘上相干载波信号,再通过低通滤波器(时域卷积滤波器特性)。 要求:载波同步(相干载波和载波信号同频同相)

4.4 单边带调制SSB 只传输一个边带,频带利用率高。带宽BSSB=BAM/2=fH;在频谱拥挤的通信场合,如短波通信、多路载波电话系统。低功耗特性。使用于移动通信系统。 缺点:设备复杂,存在技术难点,需要相干解调。

4.5 残留边带调制VSB 残留边带滤波器特性:在载频处具有互补对称特性;介于单边带与双边带之间的方案。

5 角度调制 正弦载波有三个参量:幅度、频率、相位。都可以携带消息信号。 其中,频率(FM)和相位(PM)都称为角度调制。 频率调制(FM) 幅度恒定,对瞬时相位对t求微分,得到瞬时角频率。 调频的频谱由载频分量wc两侧的无数多对边频wc±nwm组成,其幅度取决于mf; 理论上,调频的带宽无穷大; 实际中,用卡森公式计算FM带宽:BFM=2(mf+1)fm。fm为调制信号的最高频率 FM调制为非线性调制。FM解调也称鉴频 ,采用微分电路+包络检波实现。 FM的特点和应用 特点:幅度不变,包络恒定。 优势:抗噪能力强; 代价:占用较大信道带宽,频谱利用率低; 应用:高质量或信道噪声大的场合。如卫星通信、移动通信、微波通信等。

6 抗噪声性能 性能指标:输出信噪比、制度增益 输入信噪比:Ni=n0B。n0是噪声的单边功率谱密度,B=2fH是带宽,是基带带宽的2倍。

AM DSB SSB VSB(幅度调制) 相干解调器:线性解调,信号和噪声可以分开处理。 双边带和单边带调制的抗噪声性能相同。 小信噪比时,信号被干扰为噪声,产生门限效应。原因是包络检波的非线性解调作用。 信噪比固定。 FM(角度调制) FM系统可以通过增加传输带宽来改善抗噪声性能(信噪比)。

总结 频谱利用率 SSB>VSB>DSB/AM>FM 抗噪声性能:FM>DSB/SSB>VSB>AM 设备复杂度:AM最简,DSB/FM次之,SSB最复杂

二、部分源代码

function varargout = signal_generator(varargin)
% SIGNAL_GENERATOR MATLAB code for signal_generator.fig
%      SIGNAL_GENERATOR, by itself, creates a new SIGNAL_GENERATOR or raises the existing
%      singleton*.
%
%      H = SIGNAL_GENERATOR returns the handle to a new SIGNAL_GENERATOR or the handle to
%      the existing singleton*.
%
%      SIGNAL_GENERATOR('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in SIGNAL_GENERATOR.M with the given input arguments.
%
%      SIGNAL_GENERATOR('Property','Value',...) creates a new SIGNAL_GENERATOR or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before signal_generator_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to signal_generator_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 signal_generator

% Last Modified by GUIDE v2.5 12-Jul-2021 20:04:30

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @signal_generator_OpeningFcn, ...
                   'gui_OutputFcn',  @signal_generator_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 signal_generator is made visible.
function signal_generator_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 signal_generator (see VARARGIN)

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

% Update handles structure
guidata(hObject, handles);

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


% --- Outputs from this function are returned to the command line.
function varargout = signal_generator_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;


% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)

AM

% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

DSB

% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

SSB

% --- Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

FM


% --- Executes on button press in pushbutton8.
function pushbutton8_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

close(handles.figure1);
% --- Executes just before AM is made visible.
function AM_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 AM (see VARARGIN)

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

% Update handles structure
guidata(hObject, handles);

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


% --- Outputs from this function are returned to the command line.
function varargout = AM_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;


% --- Executes during object creation, after setting all properties.
function axes3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to axes3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: place code in OpeningFcn to populate axes3


% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes during object creation, after setting all properties.
function frame1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to frame1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called


% --- Executes during object creation, after setting all properties.
function text2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to text2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called


% --- Executes when entered data in editable cell(s) in uitable2.
function uitable2_CellEditCallback(hObject, eventdata, handles)
% hObject    handle to uitable2 (see GCBO)
% eventdata  structure with the following fields (see MATLAB.UI.CONTROL.TABLE)
%	Indices: row and column indices of the cell(s) edited
%	PreviousData: previous data for the cell(s) edited
%	EditData: string(s) entered by the user
%	NewData: EditData or its converted form set on the Data property. Empty if Data was not changed
%	Error: error string when failed to convert EditData to appropriate value for Data
% handles    structure with handles and user data (see GUIDATA)


% --- Executes on selection change in listbox3.
function listbox3_Callback(hObject, eventdata, handles)
% hObject    handle to listbox3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns listbox3 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from listbox3


% --- Executes during object creation, after setting all properties.
function listbox3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to listbox3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: listbox controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



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

% Hints: get(hObject,'String') returns contents of edit1 as text
%        str2double(get(hObject,'String')) returns contents of edit1 as a double


% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



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

% Hints: get(hObject,'String') returns contents of edit2 as text
%        str2double(get(hObject,'String')) returns contents of edit2 as a double


% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



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

% Hints: get(hObject,'String') returns contents of edit3 as text
%        str2double(get(hObject,'String')) returns contents of edit3 as a double


% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


f=str2num(get(handles.edit2,'String')); %f=1,1hz基带信号
A=str2num(get(handles.edit1,'String'));  % A=0.3
fc=str2num(get(handles.edit3,'String')); %fc=64  hz载波
fs=str2num(get(handles.edit4,'String')); %fs=1024;    
t=0:1/fs:2-0.5/fs;    %采样时间为02秒
x=(1+A*cos(2*pi*f*t)).*cos(2*pi*fc*t);  %调幅表达式
plot(handles.axes1,x);     

三、运行结果

在这里插入图片描述 在这里插入图片描述 在这里插入图片描述 在这里插入图片描述 在这里插入图片描述

四、matlab版本及参考文献

1 matlab版本 2014a

2 参考文献 [1] 沈再阳.精通MATLAB信号处理[M].清华大学出版社,2015. [2]高宝建,彭进业,王琳,潘建寿.信号与系统——使用MATLAB分析与实现[M].清华大学出版社,2020. [3]王文光,魏少明,任欣.信号处理与系统分析的MATLAB实现[M].电子工业出版社,2018.