【数字信号调制】基于matlab GUI ASK+OOK++BPSK+8PSK+QPSK+AM调制解调【含Matlab源码 1368期】

一、简介

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 = digital_modulation(varargin)
%DIGITAL_MODULATION 
 

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @digital_modulation_OpeningFcn, ...
                   'gui_OutputFcn',  @digital_modulation_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 digital_modulation is made visible.
function digital_modulation_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 digital_modulation (see VARARGIN)
        hold off;
        axes(handles.axes1);
        h=[1 1 0 1 0 0 1 1 1 0];
        hold off;
        bit=[];
        for n=1:2:length(h)-1;
            if h(n)==0 & h(n+1)==1
                se=[zeros(1,50) ones(1,50)];
            elseif h(n)==0 & h(n+1)==0
                se=[zeros(1,50) zeros(1,50)];
            elseif h(n)==1 & h(n+1)==0
                se=[ones(1,50) zeros(1,50)];
            elseif h(n)==1 & h(n+1)==1
                se=[ones(1,50) ones(1,50)];
            end
            bit=[bit se];
        end
        plot(bit,'LineWidth',1.5);grid on;
        axis([0 500 -1.5 1.5]);
%*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
        axes(handles.axes3)
        hold off;
        fc=30;
        g=[1 1 0 1 0 0 1 1 1 0]; %modulante
        n=1;
    while n<=length(g)
        if g(n)==0
            tx=(n-1)*0.1:0.1/100:n*0.1;
            p=(1)*sin(2*pi*fc*tx);
            plot(tx,p,'LineWidth',1.5);grid on;
            hold on;
        else 
            tx=(n-1)*0.1:0.1/100:n*0.1;
            p=(2)*sin(2*pi*fc*tx);
            plot(tx,p,'LineWidth',1.5);grid on;
            hold on;
        end
            n=n+1;
            
    end

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

% Update handles structure
guidata(hObject, handles);

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


% --- Outputs from this function are returned to the command line.
function varargout = digital_modulation_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 random.
function random_Callback(hObject, eventdata, handles)
% hObject    handle to random (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
a=round(rand(1,10)); %genarar bits aleatorios
ran=[a(1),a(2),a(3),a(4),a(5),a(6),a(7),a(8),a(9),a(10)];
set(handles.bit1,'String',ran(1));
set(handles.bit2,'String',ran(2));
set(handles.bit3,'String',ran(3));
set(handles.bit4,'String',ran(4));
set(handles.bit5,'String',ran(5));
set(handles.bit6,'String',ran(6));
set(handles.bit7,'String',ran(7));
set(handles.bit8,'String',ran(8));
set(handles.bit9,'String',ran(9));
set(handles.bit10,'String',ran(10));

%*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
handles.bits=ran;

h=handles.bits;
axes(handles.axes1)
hold off;
bit=[];
for n=1:2:length(h)-1;
    if h(n)==0 & h(n+1)==1
        se=[zeros(1,50) ones(1,50)];
    elseif h(n)==0 & h(n+1)==0
        se=[zeros(1,50) zeros(1,50)];
    elseif h(n)==1 & h(n+1)==0
        se=[ones(1,50) zeros(1,50)];
    elseif h(n)==1 & h(n+1)==1
        se=[ones(1,50) ones(1,50)];
    end
   
    bit=[bit se];
end
plot(bit,'LineWidth',1.5);grid on;
axis([0 500 -1.5 1.5]);

%*-*-*-*-*-*-*-*-*-*-*-*-
hold off;
axes(handles.axes3);
cod=get(handles.select_mod,'Value');
switch cod
%*-*-*-*Modulation ASK*-*-*-*-*-*-*-*-*
    case 1
        hold off;
        axes(handles.axes3)
        fc=30;
        g=handles.bits; %modulante
        n=1;
    while n<=length(g)
        if g(n)==0
            tx=(n-1)*0.1:0.1/100:n*0.1;
            p=(1)*sin(2*pi*fc*tx);
            plot(tx,p,'LineWidth',1.5);grid on;
            hold on;
%    axis([0 n*2/fc -3 3]);
        else 
            tx=(n-1)*0.1:0.1/100:n*0.1;
            p=(2)*sin(2*pi*fc*tx);
            plot(tx,p,'LineWidth',1.5);grid on;
            hold on;
        end
            n=n+1;
    end
    
%*-*-*-*-*-*-*-Modulation OOK*-*-*-*-*-*-*-*-*-
    case 2
        hold off;
        axes(handles.axes3);
        t=0:0.001:1;
        m=1;
        fc=30;
        g=handles.bits; %modulante
        n=1;
        while n<=length(g)
            tx=(n-1)*1/length(g):0.001:n*1/length(g);
            p=(g(n))*sin(2*pi*fc*tx);
            plot(tx,p,'LineWidth',1.5);
            hold on;
            axis([0 (n)*1/length(g) -1.5 1.5]);
            grid on;
            n=n+1;
        end
%*-*-*-*-*-*-*-Modulation BPSK*-*-*-*-*-*-*-*-*-*-*-
    case 3
        axes(handles.axes3)
        hold off;
        g=handles.bits;
        fc=10;
        n=1;
    while n<=length(g)
        if g(n)==0 %0 is -1
            tx=(n-1)*0.1:0.1/100:n*0.1;
            p=(-1)*sin(2*pi*fc*tx);
            plot(tx,p,'LineWidth',1.5);grid on;
            hold on;
        else
            tx=(n-1)*0.1:0.1/100:n*0.1;
            p=(1)*sin(2*pi*fc*tx);
            plot(tx,p,'LineWidth',1.5);grid on;
            hold on;
        end
        n=n+1;
    end
    

复制代码

三、运行结果

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

四、matlab版本及参考文献

1 matlab版本 2014a

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

猜你喜欢

转载自juejin.im/post/7015972719879520263