• 【数字信号调制】基于matlab实现AM调制系统附GUI界面


    1 内容介绍

    在设计通信系统数字信号仿真平台的基础上,应用MATLAB软件对二进制数字调制信号进行仿真,具体包括对二进制数字调制信号中的二进制幅度键控信号、二进制频移键控信号和二进制相移键控信号的仿真,并应用GUI的相应控件搭建通信系统数字信号的仿真平台。

    2 部分代码

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    %                                                                    %

    %                      AM modulation with GUI                        %

    %                                                                    %

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    function varargout = am_mod(varargin)

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

    % Last Modified by GUIDE v2.5 02-Jun-2022 16:43:51

    % Begin initialization code - DO NOT EDIT

    gui_Singleton = 1;

    gui_State = struct('gui_Name',       mfilename, ...

                       'gui_Singleton',  gui_Singleton, ...

                       'gui_OpeningFcn', @am_mod_OpeningFcn, ...

                       'gui_OutputFcn',  @am_mod_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

    % --- Executes just before am_mod is made visible.

    function am_mod_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_mod (see VARARGIN)

    set(handles.carrier,'Value',0.5);

    set(handles.mod,'Value',0.5);

    handles.ejex=0:1/1000:.5;

    axes(handles.axes1)

    y_m=.5*cos(2*pi*25*handles.ejex)+1;

    plot(handles.ejex,y_m,'--','Color',[1 0 1]);hold on;

    y_c=cos(2*pi*100*handles.ejex);

    y_am=y_m.*y_c;

    plot(handles.ejex,y_am)

    hold off;

    title('AM信号');

    ylabel('振幅');

    xlabel('时间(s)');

    axes(handles.axes2)

    plotspec(y_am,1/1000);

    title('光谱');

    %zoom on

    % Choose default command line output for am_mod

    handles.output = hObject;

    % Update handles structure

    guidata(hObject, handles);

    % uiwait(handles.figure1);

    % --- Outputs from this function are returned to the command line.

    function varargout = am_mod_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 slider movement.

    function mod_Callback(hObject, eventdata, handles)

    % hObject    handle to mod (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,'Value') returns position of slider

    %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider

    f_m=50*get(hObject,'Value');

    f_c=200*get(handles.carrier,'Value');

    set(handles.fc,'String',f_c);

    set(handles.fm,'String',f_m);

    axes(handles.axes1)

    y_m=.5*cos(2*pi*f_m*handles.ejex)+1;

    plot(handles.ejex,y_m,'--','Color',[1 0 0]);hold on;

    y_c=cos(2*pi*f_c*handles.ejex);

    y_am=y_m.*y_c;

    % --- Executes on button press in zoom.

    function zoom_Callback(hObject, eventdata, handles)

    % hObject    handle to zoom (see GCBO)

    % eventdata  reserved - to be defined in a future version of MATLAB

    % handles    structure with handles and user data (see GUIDATA)

    % Hint: get(hObject,'Value') returns toggle state of zoom

    a=get(hObject,'Value');

    if a==1

        zoom on;

        set(handles.zoom,'String','放大');

    else

        zoom off;

        set(handles.zoom,'String','缩小');

    end

     c  

    % --- Executes on button press in close.

    function close_Callback(hObject, eventdata, handles)

    % hObject    handle to close (see GCBO)

    % eventdata  reserved - to be defined in a future version of MATLAB

    % handles    structure with handles and user data (see GUIDATA)

    % Hint: get(hObject,'Value') returns toggle state of close

    clc

    close all

    3 运行结果

    4 参考文献

    [1]丁新,高丙坤. 基于MATLAB的数字调制信号仿真系统设计[J]. 长江大学学报(自科版):上旬, 2009(01X):3.

    博主简介:擅长智能优化算法神经网络预测信号处理元胞自动机图像处理路径规划无人机雷达通信无线传感器等多种领域的Matlab仿真,相关matlab代码问题可私信交流。

    部分理论引用网络文献,若有侵权联系博主删除。

  • 相关阅读:
    React.memo使用报错Component definition is missing display name
    Qt MV架构-委托类
    CMU15445 (Fall 2020) 数据库系统 Project#1 - Buffer Pool 详解
    flink的窗口
    ubuntu搭建MongoDB副本集
    SpringCloudAlibaba分布式事务解决方案Seata实战与源码分析-上
    移动端表格分页uni-app
    C# 之 FileInfo API参考
    C++项目实战——基于多设计模式下的同步&异步日志系统(总集篇)
    2023 03 CSPT2 垦田计划——二分
  • 原文地址:https://blog.csdn.net/matlab_dingdang/article/details/126800227