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

本文介绍了如何利用MATLAB设计通信系统的数字信号仿真平台,详细展示了二进制幅度键控、频移键控和相移键控信号的仿真过程,并通过GUI控件搭建了可视化界面。代码示例包括AM调制函数及相应的滑块、缩放和关闭操作。
摘要由CSDN通过智能技术生成

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代码问题可私信交流。

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

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

matlab科研助手

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值